14 #ifndef LLVM_CLANG_AST_ATTR_H 15 #define LLVM_CLANG_AST_ATTR_H 27 #include "llvm/ADT/StringSwitch.h" 28 #include "llvm/Support/ErrorHandling.h" 29 #include "llvm/Support/raw_ostream.h" 36 class ObjCInterfaceDecl;
46 unsigned AttrKind : 16;
58 void *
operator new(
size_t bytes) noexcept {
59 llvm_unreachable(
"Attrs cannot be allocated with regular 'new'.");
61 void operator delete(
void *data) noexcept {
62 llvm_unreachable(
"Attrs cannot be released with regular 'delete'.");
68 size_t Alignment = 8) noexcept {
69 return ::operator
new(Bytes,
C, Alignment);
71 void operator delete(
void *Ptr,
ASTContext &
C,
size_t Alignment) noexcept {
72 return ::operator
delete(Ptr,
C, Alignment);
78 : Range(R), AttrKind(AK), SpellingListIndex(SpellingListIndex),
80 IsLateParsed(IsLateParsed), DuplicatesAllowed(DuplicatesAllowed) {}
123 :
Attr(AK, R, SpellingListIndex, IsLateParsed, DuplicatesAllowed) {}
127 return A->
getKind() >= attr::FirstStmtAttr &&
128 A->
getKind() <= attr::LastStmtAttr;
136 :
Attr(AK, R, SpellingListIndex, IsLateParsed, DuplicatesAllowed) {}
143 return A->
getKind() >= attr::FirstInheritableAttr &&
144 A->
getKind() <= attr::LastInheritableAttr;
153 DuplicatesAllowed) {}
158 return A->
getKind() >= attr::FirstInheritableParamAttr &&
159 A->
getKind() <= attr::LastInheritableParamAttr;
171 DuplicatesAllowed) {}
176 case attr::SwiftContext:
178 case attr::SwiftErrorResult:
180 case attr::SwiftIndirectResult:
183 llvm_unreachable(
"bad parameter ABI attribute kind");
188 return A->
getKind() >= attr::FirstParameterABIAttr &&
189 A->
getKind() <= attr::LastParameterABIAttr;
193 #include "clang/AST/Attrs.inc" const char * getSpelling() const
C Language Family Type Representation.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
static bool classof(const Attr *A)
Describes how types, statements, expressions, and declarations should be printed. ...
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the clang::SanitizerKind enum.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
ParameterABI getABI() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Defines the clang::attr::Kind enum.
Defines some OpenMP-specific enums and functions.
InheritableParamAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, bool IsLateParsed, bool DuplicatesAllowed)
This parameter (which must have pointer type) uses the special Swift context-pointer ABI treatment...
void setRange(SourceRange R)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Attr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, bool IsLateParsed, bool DuplicatesAllowed)
static bool classof(const Attr *A)
This parameter (which must have pointer-to-pointer type) uses the special Swift error-result ABI trea...
A little helper class used to produce diagnostics.
static bool classof(const Attr *A)
bool isPackExpansion() const
unsigned DuplicatesAllowed
A parameter attribute which changes the argument-passing ABI rule for the parameter.
Encodes a location in the source.
bool duplicatesAllowed() const
By default, attributes cannot be duplicated when being merged; however, an attribute can override thi...
Attr * clone(ASTContext &C) const
unsigned getSpellingListIndex() const
void setPackExpansion(bool PE)
SourceLocation getLocation() const
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
ParameterABI
Kinds of parameter ABI.
SourceRange getRange() const
Dataflow Directional Tag Classes.
unsigned SpellingListIndex
An index into the spelling list of an attribute defined in Attr.td file.
bool isLateParsed() const
void setInherited(bool I)
static bool classof(const Attr *A)
Defines the clang::SourceLocation class and associated facilities.
InheritableAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, bool IsLateParsed, bool DuplicatesAllowed)
StmtAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, bool IsLateParsed, bool DuplicatesAllowed)
Defines the clang::VersionTuple class, which represents a version in the form major[.minor[.subminor]].
ParameterABIAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, bool IsLateParsed, bool DuplicatesAllowed)
A trivial tuple used to represent a source range.
attr::Kind getKind() const
SourceLocation getBegin() const
Attr - This represents one attribute.
This parameter (which must have pointer type) is a Swift indirect result parameter.