21 #include "llvm/ADT/SmallString.h"
22 #include "llvm/ADT/StringSwitch.h"
23 using namespace clang;
33 size_t AttributeList::allocated_size()
const {
35 else if (IsTypeTagForDatatype)
44 FreeLists.resize(InlineFreeListsCapacity);
50 assert((size %
sizeof(
void*)) == 0);
54 void *AttributeFactory::allocate(
size_t size) {
57 if (index < FreeLists.size()) {
59 FreeLists[index] = attr->NextInPool;
65 return Alloc.Allocate(size, llvm::AlignOf<AttributeFactory>::Alignment);
69 assert(cur &&
"reclaiming empty pool!");
75 size_t size = cur->allocated_size();
79 if (freeListIndex >= FreeLists.size())
80 FreeLists.resize(freeListIndex+1);
83 cur->NextInPool = FreeLists[freeListIndex];
84 FreeLists[freeListIndex] = cur;
103 pool->NextInPool = Head;
109 #include "clang/Sema/AttrParsedAttrKinds.inc"
114 StringRef AttrName = Name->
getName();
118 FullName += ScopeName->
getName();
124 if (IsGNU && AttrName.size() >= 4 && AttrName.startswith(
"__") &&
125 AttrName.endswith(
"__"))
126 AttrName = AttrName.slice(2, AttrName.size() - 2);
130 if (ScopeName || SyntaxUsed ==
AS_CXX11)
132 FullName += AttrName;
134 return ::getAttrKind(FullName, SyntaxUsed);
140 StringRef Name = AttrName->
getName();
141 StringRef
Scope = ScopeName ? ScopeName->
getName() :
"";
143 #include "clang/Sema/AttrSpellingListIndex.inc"
148 unsigned NumArgs : 4;
149 unsigned OptArgs : 4;
150 unsigned HasCustomParsing : 1;
151 unsigned IsTargetSpecific : 1;
153 unsigned IsKnownToGCC : 1;
158 bool (*ExistsInTarget)(
const llvm::Triple &T);
163 #include "clang/Sema/AttrParsedAttrImpl.inc"
167 return AttrInfoMap[A.
getKind()];
Defines the clang::ASTContext interface.
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
Defines the C++ template declaration subclasses.
static IdentifierLoc * create(ASTContext &Ctx, SourceLocation Loc, IdentifierInfo *Ident)
bool hasCustomParsing() const
bool(* DiagLangOpts)(Sema &S, const AttributeList &Attr)
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an AttributeList as an argument...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool hasVariadicArg() const
bool existsInTarget(const llvm::Triple &T) const
unsigned(* SpellingIndexToSemanticSpelling)(const AttributeList &Attr)
static const ParsedAttrInfo & getInfo(const AttributeList &A)
bool(* DiagAppertainsToDecl)(Sema &S, const AttributeList &Attr, const Decl *)
bool(* ExistsInTarget)(const llvm::Triple &T)
Sema - This implements semantic analysis and AST building for C.
StringRef getName() const
Return the actual identifier string.
unsigned HasCustomParsing
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 getAttributeSpellingListIndex() const
Get an index into the attribute spelling list defined in Attr.td. This index is used by an attribute ...
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
unsigned getMinArgs() const
bool diagnoseLangOpts(class Sema &S) const
unsigned IsTargetSpecific
Syntax
The style used to specify an attribute.
bool isKnownToGCC() const
unsigned getMaxArgs() const
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
bool isTargetSpecificAttr() const
static size_t getFreeListIndexForSize(size_t size)
Attr - This represents one attribute.