14#ifndef LLVM_CLANG_SEMA_PARSEDATTR_H
15#define LLVM_CLANG_SEMA_PARSEDATTR_H
22#include "llvm/ADT/PointerUnion.h"
23#include "llvm/ADT/SmallVector.h"
24#include "llvm/Support/Allocator.h"
25#include "llvm/Support/Registry.h"
26#include "llvm/Support/VersionTuple.h"
103 const Decl *D)
const {
108 const Stmt *St)
const {
114 const Decl *D)
const {
221using ArgsUnion = llvm::PointerUnion<Expr *, IdentifierLoc *>;
235 private llvm::TrailingObjects<
236 ParsedAttr, ArgsUnion, detail::AvailabilityData,
237 detail::TypeTagForDatatypeData, ParsedType, detail::PropertyData> {
238 friend TrailingObjects;
240 size_t numTrailingObjects(OverloadToken<ArgsUnion>)
const {
return NumArgs; }
241 size_t numTrailingObjects(OverloadToken<detail::AvailabilityData>)
const {
242 return IsAvailability;
245 numTrailingObjects(OverloadToken<detail::TypeTagForDatatypeData>)
const {
246 return IsTypeTagForDatatype;
248 size_t numTrailingObjects(OverloadToken<ParsedType>)
const {
249 return HasParsedType;
251 size_t numTrailingObjects(OverloadToken<detail::PropertyData>)
const {
262 unsigned NumArgs : 16;
265 mutable unsigned Invalid : 1;
268 mutable unsigned UsedAsTypeAttr : 1;
272 unsigned IsAvailability : 1;
276 unsigned IsTypeTagForDatatype : 1;
280 unsigned IsProperty : 1;
283 unsigned HasParsedType : 1;
286 mutable unsigned HasProcessingCache : 1;
289 mutable unsigned ProcessingCache : 8;
292 mutable unsigned IsPragmaClangAttribute : 1;
298 const Expr *MessageExpr;
302 ArgsUnion *getArgsBuffer() {
return getTrailingObjects<ArgsUnion>(); }
304 return getTrailingObjects<ArgsUnion>();
308 return getTrailingObjects<detail::AvailabilityData>();
311 return getTrailingObjects<detail::AvailabilityData>();
325 EllipsisLoc(ellipsisLoc), NumArgs(numArgs), Invalid(
false),
328 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
341 const Expr *replacementExpr)
344 NumArgs(1), Invalid(
false), UsedAsTypeAttr(
false), IsAvailability(
true),
346 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
347 UnavailableLoc(unavailable), MessageExpr(messageExpr),
352 introduced, deprecated, obsoleted, strict, replacementExpr);
356 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
357 IdentifierInfo *scopeName, SourceLocation scopeLoc,
358 IdentifierLoc *Parm1, IdentifierLoc *Parm2, IdentifierLoc *Parm3,
360 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
362 NumArgs(3), Invalid(
false), UsedAsTypeAttr(
false),
364 HasParsedType(
false), HasProcessingCache(
false),
365 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
373 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
374 IdentifierInfo *scopeName, SourceLocation scopeLoc,
375 IdentifierLoc *ArgKind,
ParsedType matchingCType,
376 bool layoutCompatible,
bool mustBeNull,
Syntax syntaxUsed)
379 NumArgs(1), Invalid(
false), UsedAsTypeAttr(
false),
380 IsAvailability(
false), IsTypeTagForDatatype(
true), IsProperty(
false),
381 HasParsedType(
false), HasProcessingCache(
false),
382 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
385 detail::TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
386 new (&ExtraData.MatchingCType)
ParsedType(matchingCType);
387 ExtraData.LayoutCompatible = layoutCompatible;
388 ExtraData.MustBeNull = mustBeNull;
392 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
393 IdentifierInfo *scopeName, SourceLocation scopeLoc,
397 NumArgs(0), Invalid(
false), UsedAsTypeAttr(
false),
399 HasParsedType(
true), HasProcessingCache(
false),
400 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
405 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
406 IdentifierInfo *scopeName, SourceLocation scopeLoc,
407 IdentifierInfo *getterId, IdentifierInfo *setterId,
411 NumArgs(0), Invalid(
false), UsedAsTypeAttr(
false),
412 IsAvailability(
false), IsTypeTagForDatatype(
false), IsProperty(
true),
413 HasParsedType(
false), HasProcessingCache(
false),
414 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
415 new (&getPropertyDataBuffer()) detail::PropertyData(getterId, setterId);
421 detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() {
422 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
424 const detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot()
const {
425 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
430 ParsedType &getTypeBuffer() {
return *getTrailingObjects<ParsedType>(); }
432 return *getTrailingObjects<ParsedType>();
437 detail::PropertyData &getPropertyDataBuffer() {
439 return *getTrailingObjects<detail::PropertyData>();
441 const detail::PropertyData &getPropertyDataBuffer()
const {
443 return *getTrailingObjects<detail::PropertyData>();
446 size_t allocated_size()
const;
455 void operator delete(
void *) =
delete;
471 return ProcessingCache;
475 ProcessingCache = value;
476 HasProcessingCache =
true;
495 assert(Arg < NumArgs &&
"Arg access out of range!");
496 return getArgsBuffer()[Arg];
500 return Arg < NumArgs &&
getArg(Arg).is<
Expr*>();
517 "Not an availability attribute");
523 "Not an availability attribute");
529 "Not an availability attribute");
535 "Not an availability attribute");
541 "Not an availability attribute");
542 return UnavailableLoc;
547 "Not an availability attribute");
553 "Not an availability attribute");
559 "Not a type_tag_for_datatype attribute");
565 "Not a type_tag_for_datatype attribute");
571 "Not a type_tag_for_datatype attribute");
572 return getTypeTagForDatatypeDataSlot().
MustBeNull;
576 assert(HasParsedType &&
"Not a type attribute");
577 return getTypeBuffer();
582 "Not a __delcspec(property) attribute");
583 return getPropertyDataBuffer().
GetterId;
588 "Not a __delcspec(property) attribute");
589 return getPropertyDataBuffer().
SetterId;
597 MacroExpansionLoc = Loc;
609 "if this attribute has a macro identifier.");
610 return MacroExpansionLoc;
676 case ParsedAttr::AT_OpenCLConstantAddressSpace:
678 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
680 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
682 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
684 case ParsedAttr::AT_OpenCLLocalAddressSpace:
686 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
688 case ParsedAttr::AT_OpenCLGenericAddressSpace:
699 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
701 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
703 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
705 case ParsedAttr::AT_OpenCLLocalAddressSpace:
707 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
709 case ParsedAttr::AT_OpenCLGenericAddressSpace:
719 case ParsedAttr::AT_HLSLGroupSharedAddressSpace:
762 InlineFreeListsCapacity =
766 llvm::BumpPtrAllocator Alloc;
770 SmallVector<SmallVector<ParsedAttr *, 8>, InlineFreeListsCapacity> FreeLists;
776 void *allocate(
size_t size);
798 void *allocate(
size_t size) {
799 return Factory.allocate(size);
803 Attrs.push_back(attr);
807 void remove(ParsedAttr *attr) {
808 assert(llvm::is_contained(Attrs, attr) &&
809 "Can't take attribute from a pool that doesn't own it!");
810 Attrs.erase(llvm::find(Attrs, attr));
813 void takePool(AttributePool &pool);
829 Factory.reclaimPool(*
this);
849 void *memory = allocate(
854 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
855 args, numArgs, syntax, ellipsisLoc));
865 const Expr *ReplacementExpr) {
868 attrName, attrRange, scopeName, scopeLoc, Param, introduced, deprecated,
869 obsoleted, unavailable, MessageExpr, syntax, strict, ReplacementExpr));
876 void *memory = allocate(
880 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
881 Param1, Param2, Param3, syntax));
888 ParsedType matchingCType,
bool layoutCompatible,
891 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
892 argumentKind, matchingCType,
893 layoutCompatible, mustBeNull, syntax));
901 void *memory = allocate(
905 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
906 typeArg, syntaxUsed));
915 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
916 getterId, setterId, syntaxUsed));
922 using SizeType =
decltype(std::declval<VecTy>().size());
932 bool empty()
const {
return AttrList.empty(); }
933 SizeType
size()
const {
return AttrList.size(); }
939 AttrList.push_back(newAttr);
943 assert(is_contained(AttrList, ToBeRemoved) &&
944 "Cannot remove attribute that isn't in the list");
945 AttrList.erase(llvm::find(AttrList, ToBeRemoved));
950 struct iterator : llvm::iterator_adaptor_base<iterator, VecTy::iterator,
951 std::random_access_iterator_tag,
954 iterator(VecTy::iterator I) : iterator_adaptor_base(I) {}
959 : llvm::iterator_adaptor_base<const_iterator, VecTy::const_iterator,
960 std::random_access_iterator_tag,
970 AttrList.insert(AttrList.begin(), B.I, E.I);
974 AttrList.insert(AttrList.begin(), B.I, E.I);
978 AttrList.insert(AttrList.end(), B.I, E.I);
982 AttrList.insert(AttrList.end(), B.I, E.I);
992 return *AttrList.front();
996 return *AttrList.front();
1000 return *AttrList.back();
1004 return *AttrList.back();
1008 return llvm::any_of(AttrList, [K](
const ParsedAttr *AL) {
1031 assert(&Other !=
this &&
1032 "ParsedAttributes can't take attributes from itself");
1033 addAll(Other.begin(), Other.end());
1034 Other.clearListOnly();
1039 assert(&Other !=
this &&
1040 "ParsedAttributes can't take attribute from itself");
1041 Other.getPool().remove(PA);
1060 args, numArgs, syntax, ellipsisLoc);
1073 const Expr *ReplacementExpr) {
1075 attrName, attrRange, scopeName, scopeLoc, Param, introduced, deprecated,
1076 obsoleted, unavailable, MessageExpr, syntax, strict, ReplacementExpr);
1087 Param1, Param2, Param3, syntax);
1097 ParsedType matchingCType,
bool layoutCompatible,
1100 attrName, attrRange, scopeName, scopeLoc, argumentKind, matchingCType,
1101 layoutCompatible, mustBeNull, syntax);
1112 scopeLoc, typeArg, syntaxUsed);
1125 getterId, setterId, syntaxUsed);
1137 ParsedAttributes &
Result);
1189 std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value,
int> = 0>
1192 DB.
AddTaggedVal(
reinterpret_cast<uint64_t
>(CI.getAttrName()),
1199 std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value,
int> = 0>
1202 DB.
AddTaggedVal(
reinterpret_cast<uint64_t
>(CI->getAttrName()),
Defines the Diagnostic-related interfaces.
Defines the clang::SourceLocation class and associated facilities.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Attr - This represents one attribute.
Syntax
The style used to specify an attribute.
AttributeCommonInfo(SourceRange AttrRange)
const IdentifierInfo * getAttrName() const
Kind getParsedKind() const
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
@ TypeTagForDatatypeAllocSize
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, ParsedAttr::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
ParsedAttr * createTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Syntax syntax)
ParsedAttr * createTypeAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Syntax syntaxUsed)
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param, const AvailabilityChange &introduced, const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, SourceLocation unavailable, const Expr *MessageExpr, ParsedAttr::Syntax syntax, SourceLocation strict, const Expr *ReplacementExpr)
AttributePool(AttributePool &&pool)=default
Move the given pool's allocations to this pool.
AttributePool(AttributeFactory &factory)
Create a new pool for a factory.
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Syntax syntax)
ParsedAttr * createPropertyAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Syntax syntaxUsed)
AttributePool(const AttributePool &)=delete
AttributeFactory & getFactory() const
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
Decl - This represents one declaration (or definition), e.g.
@ ak_identifierinfo
IdentifierInfo.
This represents one expression.
One of these records is kept for each identifier that is lexed.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
ParsedAttr - Represents a syntactic attribute.
bool isPackExpansion() const
const AvailabilityChange & getAvailabilityDeprecated() const
bool isTargetSpecificAttr() const
bool hasCustomParsing() const
ParsedAttr(ParsedAttr &&)=delete
LangAS asSYCLLangAS() const
If this is an OpenCL address space attribute, returns its SYCL representation in LangAS,...
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
bool isKnownToGCC() const
bool existsInTarget(const TargetInfo &Target) const
unsigned getMinArgs() const
bool checkExactlyNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has exactly as many args as Num.
IdentifierLoc * getArgAsIdent(unsigned Arg) const
bool hasParsedType() const
const AvailabilityChange & getAvailabilityIntroduced() const
void setInvalid(bool b=true) const
bool hasVariadicArg() const
const ParsedAttrInfo & getInfo() const
bool hasMacroIdentifier() const
Returns true if this attribute was declared in a macro.
ParsedAttr & operator=(ParsedAttr &&)=delete
ParsedAttr & operator=(const ParsedAttr &)=delete
void handleAttrWithDelayedArgs(Sema &S, Decl *D) const
const Expr * getReplacementExpr() const
IdentifierInfo * getPropertyDataSetter() const
bool diagnoseMutualExclusion(class Sema &S, const Decl *D) const
bool hasProcessingCache() const
SourceLocation getUnavailableLoc() const
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
unsigned getProcessingCache() const
LangAS asOpenCLLangAS() const
If this is an OpenCL address space attribute, returns its representation in LangAS,...
bool acceptsExprPack() const
const Expr * getMessageExpr() const
const ParsedType & getMatchingCType() const
const ParsedType & getTypeArg() const
SourceLocation getStrictLoc() const
bool isSupportedByPragmaAttribute() const
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
bool isArgIdent(unsigned Arg) const
Expr * getArgAsExpr(unsigned Arg) const
bool getMustBeNull() const
bool diagnoseMutualExclusion(class Sema &S, const Stmt *St) const
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
bool isUsedAsTypeAttr() const
unsigned getNumArgMembers() const
unsigned getMaxArgs() const
bool isPragmaClangAttribute() const
True if the attribute is specified using '#pragma clang attribute'.
bool slidesFromDeclToDeclSpecLegacyBehavior() const
Returns whether a [[]] attribute, if specified ahead of a declaration, should be applied to the decl-...
AttributeCommonInfo::Kind getKind() const
void setProcessingCache(unsigned value) const
SourceLocation getMacroExpansionLoc() const
ParsedAttr(const ParsedAttr &)=delete
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool > > &MatchRules) const
bool isParamExpr(size_t N) const
bool isArgExpr(unsigned Arg) const
bool getLayoutCompatible() const
void setUsedAsTypeAttr(bool Used=true)
bool isDeclspecPropertyAttribute() const
Is this the Microsoft __declspec(property) attribute?
bool diagnoseLangOpts(class Sema &S) const
ArgsUnion getArg(unsigned Arg) const
getArg - Return the specified argument.
SourceLocation getEllipsisLoc() const
IdentifierInfo * getPropertyDataGetter() const
void setMacroIdentifier(IdentifierInfo *MacroName, SourceLocation Loc)
Set the macro identifier info object that this parsed attribute was declared in if it was declared in...
LangAS asHLSLLangAS() const
If this is an HLSL address space attribute, returns its representation in LangAS, otherwise returns d...
void setIsPragmaClangAttribute()
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
const AvailabilityChange & getAvailabilityObsoleted() const
IdentifierInfo * getMacroIdentifier() const
Return the macro identifier if this attribute was declared in a macro.
static const ParsedAttributesView & none()
const ParsedAttr & front() const
const ParsedAttr & back() const
const_iterator begin() const
void addAll(const_iterator B, const_iterator E)
void addAllAtEnd(const_iterator B, const_iterator E)
void addAtEnd(ParsedAttr *newAttr)
void addAll(iterator B, iterator E)
bool hasAttribute(ParsedAttr::Kind K) const
ParsedAttr & operator[](SizeType pos)
const_iterator end() const
void remove(ParsedAttr *ToBeRemoved)
const ParsedAttr & operator[](SizeType pos) const
void addAllAtEnd(iterator B, iterator E)
ParsedAttributes - A collection of parsed attributes.
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Syntax syntax)
Add objc_bridge_related attribute.
void takeOneFrom(ParsedAttributes &Other, ParsedAttr *PA)
AttributePool & getPool() const
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param, const AvailabilityChange &introduced, const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, SourceLocation unavailable, const Expr *MessageExpr, ParsedAttr::Syntax syntax, SourceLocation strict, const Expr *ReplacementExpr)
Add availability attribute.
ParsedAttributes(const ParsedAttributes &)=delete
ParsedAttr * addNewTypeAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Syntax syntaxUsed)
Add an attribute with a single type argument.
void takeAllFrom(ParsedAttributes &Other)
ParsedAttr * addNewTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Syntax syntax)
Add type_tag_for_datatype attribute.
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, ParsedAttr::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
Add attribute with expression arguments.
ParsedAttributes(AttributeFactory &factory)
ParsedAttr * addNewPropertyAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Syntax syntaxUsed)
Add microsoft __delspec(property) attribute.
Sema - This implements semantic analysis and AST building for C.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Exposes information about the current target.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
SubjectMatchRule
A list of all the recognized kinds of attributes.
AttributeDeclKind
These constants match the enumerated choices of warn_attribute_wrong_decl_type and err_attribute_wron...
@ ExpectedFunctionMethodOrParameter
@ ExpectedFunctionWithProtoType
@ ExpectedFunctionMethodOrBlock
@ ExpectedTypeOrNamespace
@ ExpectedVariableFieldOrTag
@ ExpectedVariableOrField
@ ExpectedFunctionOrMethod
@ ExpectedVariableOrFunction
@ ExpectedFunctionVariableOrClass
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &Second, ParsedAttributes &Result)
Consumes the attributes from First and Second and concatenates them into Result.
AttributeArgumentNType
These constants match the enumerated choices of err_attribute_argument_n_type and err_attribute_argum...
@ AANT_ArgumentIntegerConstant
@ AANT_ArgumentBuiltinFunction
@ AANT_ArgumentConstantExpr
@ AANT_ArgumentIdentifier
@ Result
The result type of a method or function.
LangAS
Defines the address space values used by the address space qualifier of QualType.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
llvm::Registry< ParsedAttrInfo > ParsedAttrInfoRegistry
Represents information about a change in availability for an entity, which is part of the encoding of...
VersionTuple Version
The version number at which the change occurred.
bool isValid() const
Determine whether this availability change is valid.
SourceLocation KeywordLoc
The location of the keyword indicating the kind of change.
SourceRange VersionRange
The source range covering the version number.
Wraps an identifier and optional source location for the identifier.
static IdentifierLoc * create(ASTContext &Ctx, SourceLocation Loc, IdentifierInfo *Ident)
The syntaxes supported by this attribute and how they're spelled.
const char * NormalizedFullName
AttributeCommonInfo::Syntax Syntax
constexpr ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind=AttributeCommonInfo::NoSemaHandlerAttribute)
virtual bool acceptsLangOpts(const LangOptions &LO) const
Check if this attribute is allowed by the language we are compiling.
static ArrayRef< const ParsedAttrInfo * > getAllBuiltin()
unsigned IsKnownToGCC
True if this attribute has any spellings that are known to gcc.
ArrayRef< const char * > ArgNames
unsigned HasCustomParsing
True if the parsing does not match the semantic content.
ArrayRef< Spelling > Spellings
unsigned IsType
True if this attribute applies to types.
unsigned IsTargetSpecific
True if this attribute is only available for certain targets.
unsigned IsSupportedByPragmaAttribute
True if this attribute is supported by #pragma clang attribute.
unsigned AttrKind
Corresponds to the Kind enum.
unsigned NumArgs
The number of required arguments of this attribute.
virtual bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const
Check if this attribute appertains to St, and issue a diagnostic if not.
virtual unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const
Convert the spelling index of Attr to a semantic spelling enum value.
virtual AttrHandling handleDeclAttribute(Sema &S, Decl *D, const ParsedAttr &Attr) const
If this ParsedAttrInfo knows how to handle this ParsedAttr applied to this Decl then do so and return...
static const ParsedAttrInfo & get(const AttributeCommonInfo &A)
constexpr ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind, unsigned NumArgs, unsigned OptArgs, unsigned NumArgMembers, unsigned HasCustomParsing, unsigned AcceptsExprPack, unsigned IsTargetSpecific, unsigned IsType, unsigned IsStmt, unsigned IsKnownToGCC, unsigned IsSupportedByPragmaAttribute, ArrayRef< Spelling > Spellings, ArrayRef< const char * > ArgNames)
virtual bool isParamExpr(size_t N) const
Returns true if the specified parameter index for this attribute in Attr.td is an ExprArgument or Var...
virtual void getPragmaAttributeMatchRules(llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool > > &Rules, const LangOptions &LangOpts) const
Populate Rules with the match rules of this attribute.
virtual bool existsInTarget(const TargetInfo &Target) const
Check if this attribute is allowed when compiling for the given target.
virtual ~ParsedAttrInfo()=default
virtual bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const
Check if this attribute appertains to D, and issue a diagnostic if not.
unsigned OptArgs
The number of optional arguments of this attributes.
virtual bool diagMutualExclusion(Sema &S, const ParsedAttr &A, const Decl *D) const
Check if the given attribute is mutually exclusive with other attributes already applied to the given...
unsigned IsStmt
True if this attribute applies to statements.
unsigned NumArgMembers
The number of non-fake arguments specified in the attribute definition.
const_iterator(VecTy::const_iterator I)
reference operator*() const
reference operator*() const
iterator(VecTy::iterator I)
Describes the trailing object for Availability attribute in ParsedAttr.
AvailabilityData(const AvailabilityChange &Introduced, const AvailabilityChange &Deprecated, const AvailabilityChange &Obsoleted, SourceLocation Strict, const Expr *ReplaceExpr)
AvailabilityChange Changes[NumAvailabilitySlots]
IdentifierInfo * SetterId
PropertyData(IdentifierInfo *getterId, IdentifierInfo *setterId)
IdentifierInfo * GetterId
unsigned LayoutCompatible