20 #include "llvm/ADT/SmallString.h" 21 #include "llvm/ADT/SmallVector.h" 22 #include "llvm/ADT/StringRef.h" 27 using namespace clang;
37 size_t ParsedAttr::allocated_size()
const {
39 else if (IsTypeTagForDatatype)
43 else if (HasParsedType)
50 FreeLists.resize(InlineFreeListsCapacity);
56 assert((size %
sizeof(
void*)) == 0);
57 return ((size -
sizeof(
ParsedAttr)) /
sizeof(
void *));
60 void *AttributeFactory::allocate(
size_t size) {
63 if (index < FreeLists.size() && !FreeLists[index].empty()) {
65 FreeLists[index].pop_back();
74 size_t size = Attr->allocated_size();
78 if (freeListIndex >= FreeLists.size())
79 FreeLists.resize(freeListIndex + 1);
87 FreeLists[freeListIndex].push_back(Attr);
96 Attrs.insert(Attrs.end(), pool.Attrs.begin(), pool.Attrs.end());
100 #include "clang/Sema/AttrParsedAttrKinds.inc" 110 if (IsGNU && AttrName.size() >= 4 && AttrName.startswith(
"__") &&
111 AttrName.endswith(
"__"))
112 AttrName = AttrName.slice(2, AttrName.size() - 2);
120 StringRef AttrName = Name->
getName();
124 FullName += ScopeName->
getName();
130 if (ScopeName || SyntaxUsed == AS_CXX11 || SyntaxUsed == AS_C2x)
132 FullName += AttrName;
134 return ::getAttrKind(FullName, SyntaxUsed);
140 StringRef
Scope = ScopeName ? ScopeName->getName() :
"";
144 #include "clang/Sema/AttrSpellingListIndex.inc" 161 unsigned (*SpellingIndexToSemanticSpelling)(
const ParsedAttr &Attr);
162 void (*GetPragmaAttributeMatchRules)(
169 #include "clang/Sema/AttrParsedAttrImpl.inc" 174 return AttrInfoMap[A.
getKind()];
193 return checkAttributeMatchRuleAppliesTo(D, MatchRule);
Defines the clang::ASTContext interface.
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
static size_t getFreeListIndexForSize(size_t size)
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
The required allocation size of an availability attribute, which we want to ensure is a multiple of s...
Decl - This represents one declaration (or definition), e.g.
static IdentifierLoc * create(ASTContext &Ctx, SourceLocation Loc, IdentifierInfo *Ident)
bool(* DiagLangOpts)(Sema &S, const ParsedAttr &Attr)
bool(* ExistsInTarget)(const TargetInfo &Target)
One of these records is kept for each identifier that is lexed.
unsigned getAttributeSpellingListIndex() const
Get an index into the attribute spelling list defined in Attr.td.
SubjectMatchRule
A list of all the recognized kinds of attributes.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &MatchRules) const
bool isKnownToGCC() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool existsInTarget(const TargetInfo &Target) const
unsigned getMinArgs() const
Scope - A scope is a transient data structure that is used while parsing the program.
bool hasVariadicArg() const
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
bool(* DiagAppertainsToDecl)(Sema &S, const ParsedAttr &Attr, const Decl *)
bool isTargetSpecificAttr() const
bool hasCustomParsing() const
Sema - This implements semantic analysis and AST building for C.
Exposes information about the current target.
unsigned HasCustomParsing
unsigned IsSupportedByPragmaAttribute
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Wraps an identifier and optional source location for the identifier.
The result type of a method or function.
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
Encodes a location in the source.
Syntax
The style used to specify an attribute.
ParsedAttr - Represents a syntactic attribute.
bool diagnoseLangOpts(class Sema &S) const
static StringRef normalizeAttrName(StringRef AttrName, StringRef ScopeName, ParsedAttr::Syntax SyntaxUsed)
StringRef getName() const
Return the actual identifier string.
Dataflow Directional Tag Classes.
unsigned IsTargetSpecific
void(* GetPragmaAttributeMatchRules)(llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &Rules, const LangOptions &LangOpts)
static const ParsedAttrInfo & getInfo(const ParsedAttr &A)
unsigned getMaxArgs() const
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
unsigned(* SpellingIndexToSemanticSpelling)(const ParsedAttr &Attr)
Defines the clang::TargetInfo interface.
bool isSupportedByPragmaAttribute() const
Attr - This represents one attribute.