14#ifndef LLVM_CLANG_SEMA_PARSEDATTR_H
15#define LLVM_CLANG_SEMA_PARSEDATTR_H
23#include "llvm/ADT/PointerUnion.h"
24#include "llvm/ADT/SmallVector.h"
25#include "llvm/Support/Allocator.h"
26#include "llvm/Support/VersionTuple.h"
85 LLVM_PREFERRED_TYPE(
bool)
87 LLVM_PREFERRED_TYPE(
bool)
94 : GetterId(getterId), SetterId(setterId) {}
110using ArgsUnion = llvm::PointerUnion<Expr *, IdentifierLoc *>;
124 private llvm::TrailingObjects<
125 ParsedAttr, ArgsUnion, detail::AvailabilityData,
126 detail::TypeTagForDatatypeData, ParsedType, detail::PropertyData> {
127 friend TrailingObjects;
129 size_t numTrailingObjects(OverloadToken<ArgsUnion>)
const {
return NumArgs; }
130 size_t numTrailingObjects(OverloadToken<detail::AvailabilityData>)
const {
131 return IsAvailability;
134 numTrailingObjects(OverloadToken<detail::TypeTagForDatatypeData>)
const {
135 return IsTypeTagForDatatype;
137 size_t numTrailingObjects(OverloadToken<ParsedType>)
const {
138 return HasParsedType;
140 size_t numTrailingObjects(OverloadToken<detail::PropertyData>)
const {
151 unsigned NumArgs : 16;
154 LLVM_PREFERRED_TYPE(
bool)
155 mutable unsigned Invalid : 1;
158 LLVM_PREFERRED_TYPE(
bool)
159 mutable unsigned UsedAsTypeAttr : 1;
163 LLVM_PREFERRED_TYPE(
bool)
164 unsigned IsAvailability : 1;
168 LLVM_PREFERRED_TYPE(
bool)
169 unsigned IsTypeTagForDatatype : 1;
173 LLVM_PREFERRED_TYPE(
bool)
174 unsigned IsProperty : 1;
177 LLVM_PREFERRED_TYPE(
bool)
178 unsigned HasParsedType : 1;
181 LLVM_PREFERRED_TYPE(
bool)
182 mutable unsigned HasProcessingCache : 1;
185 mutable unsigned ProcessingCache : 8;
188 LLVM_PREFERRED_TYPE(
bool)
189 mutable unsigned IsPragmaClangAttribute : 1;
195 const Expr *MessageExpr;
199 ArgsUnion *getArgsBuffer() {
return getTrailingObjects<ArgsUnion>(); }
201 return getTrailingObjects<ArgsUnion>();
205 return getTrailingObjects<detail::AvailabilityData>();
208 return getTrailingObjects<detail::AvailabilityData>();
221 EllipsisLoc(ellipsisLoc), NumArgs(numArgs), Invalid(
false),
224 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
237 const Expr *replacementExpr)
239 NumArgs(1), Invalid(
false), UsedAsTypeAttr(
false), IsAvailability(
true),
241 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
242 UnavailableLoc(unavailable), MessageExpr(messageExpr),
247 introduced, deprecated, obsoleted, strict, replacementExpr);
251 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
252 IdentifierInfo *scopeName, SourceLocation scopeLoc,
253 IdentifierLoc *Parm1, IdentifierLoc *Parm2, IdentifierLoc *Parm3,
255 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
256 NumArgs(3), Invalid(
false), UsedAsTypeAttr(
false),
258 HasParsedType(
false), HasProcessingCache(
false),
259 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
260 ArgsUnion *Args = getArgsBuffer();
267 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
268 IdentifierInfo *scopeName, SourceLocation scopeLoc,
269 IdentifierLoc *ArgKind, ParsedType matchingCType,
270 bool layoutCompatible,
bool mustBeNull, Form formUsed)
271 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
273 IsAvailability(
false), IsTypeTagForDatatype(
true), IsProperty(
false),
274 HasParsedType(
false), HasProcessingCache(
false),
275 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
277 memcpy(getArgsBuffer(), &PVal,
sizeof(ArgsUnion));
278 detail::TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
279 new (&ExtraData.MatchingCType)
ParsedType(matchingCType);
280 ExtraData.LayoutCompatible = layoutCompatible;
281 ExtraData.MustBeNull = mustBeNull;
285 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
286 IdentifierInfo *scopeName, SourceLocation scopeLoc,
287 ParsedType typeArg, Form formUsed, SourceLocation ellipsisLoc)
288 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
291 IsTypeTagForDatatype(
false), IsProperty(
false), HasParsedType(
true),
292 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
293 Info(ParsedAttrInfo::get(*this)) {
298 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
299 IdentifierInfo *scopeName, SourceLocation scopeLoc,
300 IdentifierInfo *getterId, IdentifierInfo *setterId, Form formUsed)
301 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
303 IsAvailability(
false), IsTypeTagForDatatype(
false), IsProperty(
true),
304 HasParsedType(
false), HasProcessingCache(
false),
305 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
306 new (&getPropertyDataBuffer()) detail::PropertyData(getterId, setterId);
312 detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() {
313 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
315 const detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot()
const {
316 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
321 ParsedType &getTypeBuffer() {
return *getTrailingObjects<ParsedType>(); }
323 return *getTrailingObjects<ParsedType>();
328 detail::PropertyData &getPropertyDataBuffer() {
330 return *getTrailingObjects<detail::PropertyData>();
332 const detail::PropertyData &getPropertyDataBuffer()
const {
334 return *getTrailingObjects<detail::PropertyData>();
337 size_t allocated_size()
const;
346 void operator delete(
void *) =
delete;
361 assert(hasProcessingCache());
362 return ProcessingCache;
366 ProcessingCache = value;
367 HasProcessingCache =
true;
386 assert(Arg < NumArgs &&
"Arg access out of range!");
387 return getArgsBuffer()[Arg];
391 return Arg < NumArgs && getArg(Arg).is<
Expr*>();
395 return getArg(Arg).get<
Expr*>();
407 assert(getParsedKind() == AT_Availability &&
408 "Not an availability attribute");
409 return getAvailabilityData()->Changes[detail::IntroducedSlot];
413 assert(getParsedKind() == AT_Availability &&
414 "Not an availability attribute");
415 return getAvailabilityData()->Changes[detail::DeprecatedSlot];
419 assert(getParsedKind() == AT_Availability &&
420 "Not an availability attribute");
421 return getAvailabilityData()->Changes[detail::ObsoletedSlot];
425 assert(getParsedKind() == AT_Availability &&
426 "Not an availability attribute");
427 return getAvailabilityData()->StrictLoc;
431 assert(getParsedKind() == AT_Availability &&
432 "Not an availability attribute");
433 return UnavailableLoc;
437 assert(getParsedKind() == AT_Availability &&
438 "Not an availability attribute");
443 assert(getParsedKind() == AT_Availability &&
444 "Not an availability attribute");
445 return getAvailabilityData()->Replacement;
449 assert(getParsedKind() == AT_TypeTagForDatatype &&
450 "Not a type_tag_for_datatype attribute");
451 return getTypeTagForDatatypeDataSlot().MatchingCType;
455 assert(getParsedKind() == AT_TypeTagForDatatype &&
456 "Not a type_tag_for_datatype attribute");
457 return getTypeTagForDatatypeDataSlot().LayoutCompatible;
461 assert(getParsedKind() == AT_TypeTagForDatatype &&
462 "Not a type_tag_for_datatype attribute");
463 return getTypeTagForDatatypeDataSlot().MustBeNull;
467 assert(HasParsedType &&
"Not a type attribute");
468 return getTypeBuffer();
472 assert(isDeclspecPropertyAttribute() &&
473 "Not a __delcspec(property) attribute");
474 return getPropertyDataBuffer().GetterId;
478 assert(isDeclspecPropertyAttribute() &&
479 "Not a __delcspec(property) attribute");
480 return getPropertyDataBuffer().SetterId;
488 MacroExpansionLoc = Loc;
499 assert(hasMacroIdentifier() &&
"Can only get the macro expansion location "
500 "if this attribute has a macro identifier.");
501 return MacroExpansionLoc;
506 bool checkExactlyNumArgs(
class Sema &S,
unsigned Num)
const;
509 bool checkAtLeastNumArgs(
class Sema &S,
unsigned Num)
const;
512 bool checkAtMostNumArgs(
class Sema &S,
unsigned Num)
const;
514 bool isTargetSpecificAttr()
const;
515 bool isTypeAttr()
const;
516 bool isStmtAttr()
const;
518 bool hasCustomParsing()
const;
519 bool acceptsExprPack()
const;
520 bool isParamExpr(
size_t N)
const;
521 unsigned getMinArgs()
const;
522 unsigned getMaxArgs()
const;
523 unsigned getNumArgMembers()
const;
524 bool hasVariadicArg()
const;
525 void handleAttrWithDelayedArgs(
Sema &S,
Decl *D)
const;
526 bool diagnoseAppertainsTo(
class Sema &S,
const Decl *D)
const;
527 bool diagnoseAppertainsTo(
class Sema &S,
const Stmt *St)
const;
528 bool diagnoseMutualExclusion(
class Sema &S,
const Decl *D)
const;
539 bool diagnoseLangOpts(
class Sema &S)
const;
541 bool isKnownToGCC()
const;
542 bool isSupportedByPragmaAttribute()
const;
554 bool slidesFromDeclToDeclSpecLegacyBehavior()
const;
561 unsigned getSemanticSpelling()
const;
566 switch (getParsedKind()) {
567 case ParsedAttr::AT_OpenCLConstantAddressSpace:
568 return LangAS::opencl_constant;
569 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
570 return LangAS::opencl_global;
571 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
572 return LangAS::opencl_global_device;
573 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
574 return LangAS::opencl_global_host;
575 case ParsedAttr::AT_OpenCLLocalAddressSpace:
576 return LangAS::opencl_local;
577 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
578 return LangAS::opencl_private;
579 case ParsedAttr::AT_OpenCLGenericAddressSpace:
580 return LangAS::opencl_generic;
582 return LangAS::Default;
590 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
591 return LangAS::sycl_global;
592 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
593 return LangAS::sycl_global_device;
594 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
595 return LangAS::sycl_global_host;
596 case ParsedAttr::AT_OpenCLLocalAddressSpace:
597 return LangAS::sycl_local;
598 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
599 return LangAS::sycl_private;
600 case ParsedAttr::AT_OpenCLGenericAddressSpace:
602 return LangAS::Default;
609 switch (getParsedKind()) {
610 case ParsedAttr::AT_HLSLGroupSharedAddressSpace:
611 return LangAS::hlsl_groupshared;
613 return LangAS::Default;
632 AvailabilityAllocSize =
636 TypeTagForDatatypeAllocSize =
653 InlineFreeListsCapacity =
654 1 + (AvailabilityAllocSize -
sizeof(
ParsedAttr)) /
sizeof(
void *)
657 llvm::BumpPtrAllocator Alloc;
661 SmallVector<SmallVector<ParsedAttr *, 8>, InlineFreeListsCapacity> FreeLists;
667 void *allocate(
size_t size);
690 void *allocate(
size_t size) {
691 return Factory.allocate(size);
695 Attrs.push_back(attr);
699 void remove(ParsedAttr *attr) {
700 assert(llvm::is_contained(Attrs, attr) &&
701 "Can't take attribute from a pool that doesn't own it!");
702 Attrs.erase(llvm::find(Attrs, attr));
705 void takePool(AttributePool &pool);
728 Factory.reclaimPool(*
this);
751 void *memory = allocate(
756 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
757 args, numArgs, form, ellipsisLoc));
767 const Expr *ReplacementExpr) {
768 void *memory = allocate(AttributeFactory::AvailabilityAllocSize);
770 attrName, attrRange, scopeName, scopeLoc, Param, introduced, deprecated,
771 obsoleted, unavailable, MessageExpr, form, strict, ReplacementExpr));
778 void *memory = allocate(
782 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
783 Param1, Param2, Param3, form));
790 ParsedType matchingCType,
bool layoutCompatible,
792 void *memory = allocate(AttributeFactory::TypeTagForDatatypeAllocSize);
793 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
794 argumentKind, matchingCType,
795 layoutCompatible, mustBeNull, form));
804 void *memory = allocate(
808 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
809 typeArg, formUsed, ellipsisLoc));
817 void *memory = allocate(AttributeFactory::PropertyAllocSize);
818 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
819 getterId, setterId, formUsed));
826 using SizeType =
decltype(std::declval<VecTy>().size());
836 bool empty()
const {
return AttrList.empty(); }
837 SizeType
size()
const {
return AttrList.size(); }
843 AttrList.push_back(newAttr);
847 assert(is_contained(AttrList, ToBeRemoved) &&
848 "Cannot remove attribute that isn't in the list");
849 AttrList.erase(llvm::find(AttrList, ToBeRemoved));
854 struct iterator : llvm::iterator_adaptor_base<iterator, VecTy::iterator,
855 std::random_access_iterator_tag,
858 iterator(VecTy::iterator I) : iterator_adaptor_base(I) {}
863 : llvm::iterator_adaptor_base<const_iterator, VecTy::const_iterator,
864 std::random_access_iterator_tag,
874 AttrList.insert(AttrList.begin(), B.I, E.I);
878 AttrList.insert(AttrList.begin(), B.I, E.I);
882 AttrList.insert(AttrList.end(), B.I, E.I);
886 AttrList.insert(AttrList.end(), B.I, E.I);
896 return *AttrList.front();
900 return *AttrList.front();
904 return *AttrList.back();
908 return *AttrList.back();
912 return llvm::any_of(AttrList, [K](
const ParsedAttr *AL) {
918 auto It = llvm::find_if(AttrList, [](
const ParsedAttr *AL) {
921 if (It != AttrList.end())
933 : StringLiterals(StringLiteralBits) {}
936 if (I >= StringLiterals.size())
937 return StringLiterals.test(StringLiterals.size() - 1);
938 return StringLiterals.test(I);
942 std::bitset<32> StringLiterals;
960 assert(&
Other !=
this &&
961 "ParsedAttributes can't take attributes from itself");
963 Other.clearListOnly();
964 pool.takeAllFrom(
Other.pool);
968 assert(&
Other !=
this &&
969 "ParsedAttributes can't take attribute from itself");
970 Other.getPool().remove(PA);
987 ParsedAttr *
attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
988 args, numArgs, form, ellipsisLoc);
1001 const Expr *ReplacementExpr) {
1003 attrName, attrRange, scopeName, scopeLoc, Param, introduced, deprecated,
1004 obsoleted, unavailable, MessageExpr, form, strict, ReplacementExpr);
1014 ParsedAttr *
attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
1015 Param1, Param2, Param3, form);
1025 ParsedType matchingCType,
bool layoutCompatible,
1028 attrName, attrRange, scopeName, scopeLoc, argumentKind, matchingCType,
1029 layoutCompatible, mustBeNull, form);
1040 pool.createTypeAttribute(attrName, attrRange, scopeName, scopeLoc,
1041 typeArg, formUsed, ellipsisLoc);
1053 attrName, attrRange, scopeName, scopeLoc, getterId, setterId, formUsed);
1065 ParsedAttributes &
Result);
1117 std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value,
int> = 0>
1120 DB.
AddTaggedVal(
reinterpret_cast<uint64_t
>(CI.getAttrName()),
1127 std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value,
int> = 0>
1130 DB.
AddTaggedVal(
reinterpret_cast<uint64_t
>(CI->getAttrName()),
Defines the Diagnostic-related interfaces.
static Decl::Kind getKind(const Decl *D)
llvm::MachO::Target Target
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 ...
const IdentifierInfo * getAttrName() const
Kind getParsedKind() const
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form, SourceLocation ellipsisLoc=SourceLocation())
ParsedAttr * createTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Form form)
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::Form form)
AttributePool & operator=(AttributePool &&pool)=delete
AttributePool(const AttributePool &)=delete
AttributeFactory & getFactory() const
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::Form form, SourceLocation strict, const Expr *ReplacementExpr)
ParsedAttr * createPropertyAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Form formUsed)
ParsedAttr * createTypeAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Form formUsed, SourceLocation ellipsisLoc)
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
AttributePool & operator=(const AttributePool &)=delete
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
ParsedAttr(ParsedAttr &&)=delete
LangAS asSYCLLangAS() const
If this is an OpenCL address space attribute, returns its SYCL representation in LangAS,...
IdentifierLoc * getArgAsIdent(unsigned Arg) const
bool hasParsedType() const
const AvailabilityChange & getAvailabilityIntroduced() const
void setInvalid(bool b=true) 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
const Expr * getReplacementExpr() const
IdentifierInfo * getPropertyDataSetter() const
bool hasProcessingCache() const
SourceLocation getUnavailableLoc() const
unsigned getProcessingCache() const
LangAS asOpenCLLangAS() const
If this is an OpenCL address space attribute, returns its representation in LangAS,...
const Expr * getMessageExpr() const
const ParsedType & getMatchingCType() const
const ParsedType & getTypeArg() const
SourceLocation getStrictLoc() 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 isUsedAsTypeAttr() const
bool isPragmaClangAttribute() const
True if the attribute is specified using '#pragma clang attribute'.
AttributeCommonInfo::Kind getKind() const
void setProcessingCache(unsigned value) const
SourceLocation getMacroExpansionLoc() const
ParsedAttr(const ParsedAttr &)=delete
bool isArgExpr(unsigned Arg) const
bool getLayoutCompatible() const
void setUsedAsTypeAttr(bool Used=true)
bool isDeclspecPropertyAttribute() const
Is this the Microsoft __declspec(property) attribute?
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()
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
bool hasMSPropertyAttr() const
const ParsedAttr & back() const
const_iterator begin() const
const ParsedAttr * getMSPropertyAttr() 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, ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form, SourceLocation ellipsisLoc=SourceLocation())
Add attribute with expression arguments.
void takeOneFrom(ParsedAttributes &Other, ParsedAttr *PA)
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Form form)
Add objc_bridge_related attribute.
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::Form form, SourceLocation strict, const Expr *ReplacementExpr)
Add availability attribute.
ParsedAttributes & operator=(const ParsedAttributes &)=delete
ParsedAttr * addNewPropertyAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Form formUsed)
Add microsoft __delspec(property) attribute.
ParsedAttributes(const ParsedAttributes &)=delete
void takeAllFrom(ParsedAttributes &Other)
ParsedAttributes(AttributeFactory &factory)
ParsedAttr * addNewTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Form form)
Add type_tag_for_datatype attribute.
ParsedAttr * addNewTypeAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Form formUsed, SourceLocation ellipsisLoc=SourceLocation())
Add an attribute with a single type argument.
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.
The JSON file list parser is used to communicate input to InstallAPI.
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.
@ Other
Other implicit parameter.
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.
unsigned AttrKind
Corresponds to the Kind enum.
ParsedAttributeArgumentsProperties(uint32_t StringLiteralBits)
bool isStringLiteralArg(unsigned I) const
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]
PropertyData(IdentifierInfo *getterId, IdentifierInfo *setterId)
IdentifierInfo * GetterId
unsigned LayoutCompatible