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"
88 LLVM_PREFERRED_TYPE(
bool)
90 LLVM_PREFERRED_TYPE(
bool)
97 : GetterId(getterId), SetterId(setterId) {}
113 using ArgsUnion = llvm::PointerUnion<Expr *, IdentifierLoc *>;
127 private llvm::TrailingObjects<
128 ParsedAttr, ArgsUnion, detail::AvailabilityData,
129 detail::TypeTagForDatatypeData, ParsedType, detail::PropertyData> {
130 friend TrailingObjects;
132 size_t numTrailingObjects(OverloadToken<ArgsUnion>)
const {
return NumArgs; }
133 size_t numTrailingObjects(OverloadToken<detail::AvailabilityData>)
const {
134 return IsAvailability;
137 numTrailingObjects(OverloadToken<detail::TypeTagForDatatypeData>)
const {
138 return IsTypeTagForDatatype;
140 size_t numTrailingObjects(OverloadToken<ParsedType>)
const {
141 return HasParsedType;
143 size_t numTrailingObjects(OverloadToken<detail::PropertyData>)
const {
154 unsigned NumArgs : 16;
157 LLVM_PREFERRED_TYPE(
bool)
158 mutable unsigned Invalid : 1;
161 LLVM_PREFERRED_TYPE(
bool)
162 mutable unsigned UsedAsTypeAttr : 1;
166 LLVM_PREFERRED_TYPE(
bool)
167 unsigned IsAvailability : 1;
171 LLVM_PREFERRED_TYPE(
bool)
172 unsigned IsTypeTagForDatatype : 1;
176 LLVM_PREFERRED_TYPE(
bool)
177 unsigned IsProperty : 1;
180 LLVM_PREFERRED_TYPE(
bool)
181 unsigned HasParsedType : 1;
184 LLVM_PREFERRED_TYPE(
bool)
185 mutable unsigned HasProcessingCache : 1;
188 mutable unsigned ProcessingCache : 8;
191 LLVM_PREFERRED_TYPE(
bool)
192 mutable unsigned IsPragmaClangAttribute : 1;
198 const Expr *MessageExpr;
202 ArgsUnion *getArgsBuffer() {
return getTrailingObjects<ArgsUnion>(); }
204 return getTrailingObjects<ArgsUnion>();
208 return getTrailingObjects<detail::AvailabilityData>();
211 return getTrailingObjects<detail::AvailabilityData>();
224 EllipsisLoc(ellipsisLoc), NumArgs(numArgs),
Invalid(
false),
227 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
244 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
245 UnavailableLoc(unavailable), MessageExpr(messageExpr),
249 new (getAvailabilityData())
251 replacementExpr, environmentLoc);
255 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
256 IdentifierInfo *scopeName, SourceLocation scopeLoc,
257 IdentifierLoc *Parm1, IdentifierLoc *Parm2, IdentifierLoc *Parm3,
259 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
262 HasParsedType(
false), HasProcessingCache(
false),
263 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
271 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
272 IdentifierInfo *scopeName, SourceLocation scopeLoc,
273 IdentifierLoc *ArgKind,
ParsedType matchingCType,
274 bool layoutCompatible,
bool mustBeNull, Form formUsed)
275 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
277 IsAvailability(
false), IsTypeTagForDatatype(
true), IsProperty(
false),
278 HasParsedType(
false), HasProcessingCache(
false),
279 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
282 detail::TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
283 new (&ExtraData.MatchingCType)
ParsedType(matchingCType);
284 ExtraData.LayoutCompatible = layoutCompatible;
285 ExtraData.MustBeNull = mustBeNull;
289 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
290 IdentifierInfo *scopeName, SourceLocation scopeLoc,
291 ParsedType typeArg, Form formUsed, SourceLocation ellipsisLoc)
292 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
295 IsTypeTagForDatatype(
false), IsProperty(
false), HasParsedType(
true),
296 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
297 Info(ParsedAttrInfo::get(*this)) {
302 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
303 IdentifierInfo *scopeName, SourceLocation scopeLoc,
304 IdentifierInfo *getterId, IdentifierInfo *setterId, Form formUsed)
305 : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc, formUsed),
307 IsAvailability(
false), IsTypeTagForDatatype(
false), IsProperty(
true),
308 HasParsedType(
false), HasProcessingCache(
false),
309 IsPragmaClangAttribute(
false), Info(ParsedAttrInfo::get(*this)) {
310 new (&getPropertyDataBuffer()) detail::PropertyData(getterId, setterId);
316 detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() {
317 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
319 const detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot()
const {
320 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
325 ParsedType &getTypeBuffer() {
return *getTrailingObjects<ParsedType>(); }
327 return *getTrailingObjects<ParsedType>();
332 detail::PropertyData &getPropertyDataBuffer() {
334 return *getTrailingObjects<detail::PropertyData>();
336 const detail::PropertyData &getPropertyDataBuffer()
const {
338 return *getTrailingObjects<detail::PropertyData>();
341 size_t allocated_size()
const;
350 void operator delete(
void *) =
delete;
365 assert(hasProcessingCache());
366 return ProcessingCache;
370 ProcessingCache = value;
371 HasProcessingCache =
true;
390 assert(Arg < NumArgs &&
"Arg access out of range!");
391 return getArgsBuffer()[Arg];
395 return Arg < NumArgs && getArg(Arg).is<
Expr*>();
399 return getArg(Arg).get<
Expr*>();
411 assert(getParsedKind() == AT_Availability &&
412 "Not an availability attribute");
417 assert(getParsedKind() == AT_Availability &&
418 "Not an availability attribute");
423 assert(getParsedKind() == AT_Availability &&
424 "Not an availability attribute");
429 assert(getParsedKind() == AT_Availability &&
430 "Not an availability attribute");
431 return getAvailabilityData()->StrictLoc;
435 assert(getParsedKind() == AT_Availability &&
436 "Not an availability attribute");
437 return UnavailableLoc;
441 assert(getParsedKind() == AT_Availability &&
442 "Not an availability attribute");
447 assert(getParsedKind() == AT_Availability &&
448 "Not an availability attribute");
449 return getAvailabilityData()->Replacement;
453 assert(getParsedKind() == AT_Availability &&
454 "Not an availability attribute");
455 return getAvailabilityData()->EnvironmentLoc;
459 assert(getParsedKind() == AT_TypeTagForDatatype &&
460 "Not a type_tag_for_datatype attribute");
461 return getTypeTagForDatatypeDataSlot().MatchingCType;
465 assert(getParsedKind() == AT_TypeTagForDatatype &&
466 "Not a type_tag_for_datatype attribute");
467 return getTypeTagForDatatypeDataSlot().LayoutCompatible;
471 assert(getParsedKind() == AT_TypeTagForDatatype &&
472 "Not a type_tag_for_datatype attribute");
473 return getTypeTagForDatatypeDataSlot().MustBeNull;
477 assert(HasParsedType &&
"Not a type attribute");
478 return getTypeBuffer();
482 assert(isDeclspecPropertyAttribute() &&
483 "Not a __delcspec(property) attribute");
484 return getPropertyDataBuffer().GetterId;
488 assert(isDeclspecPropertyAttribute() &&
489 "Not a __delcspec(property) attribute");
490 return getPropertyDataBuffer().SetterId;
498 MacroExpansionLoc =
Loc;
509 assert(hasMacroIdentifier() &&
"Can only get the macro expansion location "
510 "if this attribute has a macro identifier.");
511 return MacroExpansionLoc;
516 bool checkExactlyNumArgs(
class Sema &S,
unsigned Num)
const;
519 bool checkAtLeastNumArgs(
class Sema &S,
unsigned Num)
const;
522 bool checkAtMostNumArgs(
class Sema &S,
unsigned Num)
const;
524 bool isTargetSpecificAttr()
const;
525 bool isTypeAttr()
const;
526 bool isStmtAttr()
const;
528 bool hasCustomParsing()
const;
529 bool acceptsExprPack()
const;
530 bool isParamExpr(
size_t N)
const;
531 unsigned getMinArgs()
const;
532 unsigned getMaxArgs()
const;
533 unsigned getNumArgMembers()
const;
534 bool hasVariadicArg()
const;
535 void handleAttrWithDelayedArgs(
Sema &S,
Decl *D)
const;
536 bool diagnoseAppertainsTo(
class Sema &S,
const Decl *D)
const;
537 bool diagnoseAppertainsTo(
class Sema &S,
const Stmt *St)
const;
538 bool diagnoseMutualExclusion(
class Sema &S,
const Decl *D)
const;
549 bool diagnoseLangOpts(
class Sema &S)
const;
551 bool isKnownToGCC()
const;
552 bool isSupportedByPragmaAttribute()
const;
553 bool supportsNonconformingLambdaSyntax()
const;
565 bool slidesFromDeclToDeclSpecLegacyBehavior()
const;
572 unsigned getSemanticSpelling()
const;
577 switch (getParsedKind()) {
578 case ParsedAttr::AT_OpenCLConstantAddressSpace:
580 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
582 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
584 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
586 case ParsedAttr::AT_OpenCLLocalAddressSpace:
588 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
590 case ParsedAttr::AT_OpenCLGenericAddressSpace:
603 case ParsedAttr::AT_OpenCLConstantAddressSpace:
605 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
607 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
609 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
611 case ParsedAttr::AT_OpenCLLocalAddressSpace:
613 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
615 case ParsedAttr::AT_OpenCLGenericAddressSpace:
624 switch (getParsedKind()) {
625 case ParsedAttr::AT_HLSLGroupSharedAddressSpace:
647 AvailabilityAllocSize =
651 TypeTagForDatatypeAllocSize =
668 InlineFreeListsCapacity =
669 1 + (AvailabilityAllocSize -
sizeof(
ParsedAttr)) /
sizeof(
void *)
672 llvm::BumpPtrAllocator Alloc;
676 SmallVector<SmallVector<ParsedAttr *, 8>, InlineFreeListsCapacity> FreeLists;
682 void *allocate(
size_t size);
705 void *allocate(
size_t size) {
706 return Factory.allocate(size);
710 Attrs.push_back(
attr);
715 assert(llvm::is_contained(Attrs,
attr) &&
716 "Can't take attribute from a pool that doesn't own it!");
717 Attrs.erase(llvm::find(Attrs,
attr));
720 void takePool(AttributePool &pool);
743 Factory.reclaimPool(*
this);
761 void *memory = allocate(
766 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
767 args, numArgs, form, ellipsisLoc));
777 const Expr *ReplacementExpr,
780 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
781 Param, introduced, deprecated, obsoleted,
782 unavailable, MessageExpr, form, strict,
783 ReplacementExpr, EnvironmentLoc));
790 void *memory = allocate(
794 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
795 Param1, Param2, Param3, form));
802 ParsedType matchingCType,
bool layoutCompatible,
805 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
806 argumentKind, matchingCType,
807 layoutCompatible, mustBeNull, form));
816 void *memory = allocate(
820 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
821 typeArg, formUsed, ellipsisLoc));
830 return add(
new (memory)
ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
831 getterId, setterId, formUsed));
838 using SizeType = decltype(std::declval<VecTy>().size());
848 bool empty()
const {
return AttrList.empty(); }
849 SizeType
size()
const {
return AttrList.size(); }
855 AttrList.push_back(newAttr);
859 assert(is_contained(AttrList, ToBeRemoved) &&
860 "Cannot remove attribute that isn't in the list");
861 AttrList.erase(llvm::find(AttrList, ToBeRemoved));
866 struct iterator : llvm::iterator_adaptor_base<iterator, VecTy::iterator,
867 std::random_access_iterator_tag,
870 iterator(VecTy::iterator I) : iterator_adaptor_base(I) {}
875 : llvm::iterator_adaptor_base<const_iterator, VecTy::const_iterator,
876 std::random_access_iterator_tag,
886 AttrList.insert(AttrList.begin(), B.I, E.I);
890 AttrList.insert(AttrList.begin(), B.I, E.I);
894 AttrList.insert(AttrList.end(), B.I, E.I);
898 AttrList.insert(AttrList.end(), B.I, E.I);
908 return *AttrList.front();
912 return *AttrList.front();
916 return *AttrList.back();
920 return *AttrList.back();
924 return llvm::any_of(AttrList, [K](
const ParsedAttr *AL) {
930 auto It = llvm::find_if(AttrList, [](
const ParsedAttr *AL) {
933 if (It != AttrList.end())
945 : StringLiterals(StringLiteralBits) {}
948 if (I >= StringLiterals.size())
949 return StringLiterals.test(StringLiterals.size() - 1);
950 return StringLiterals.test(I);
954 std::bitset<32> StringLiterals;
973 assert(&
Other !=
this &&
974 "ParsedAttributes can't take attributes from itself");
976 Other.clearListOnly();
977 pool.takeAllFrom(
Other.pool);
981 assert(&
Other !=
this &&
982 "ParsedAttributes can't take attribute from itself");
983 Other.getPool().remove(PA);
1000 ParsedAttr *
attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
1001 args, numArgs, form, ellipsisLoc);
1014 const Expr *ReplacementExpr,
1017 pool.create(attrName, attrRange, scopeName, scopeLoc, Param, introduced,
1018 deprecated, obsoleted, unavailable, MessageExpr, form,
1019 strict, ReplacementExpr, EnvironmentLoc);
1029 ParsedAttr *
attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
1030 Param1, Param2, Param3, form);
1040 ParsedType matchingCType,
bool layoutCompatible,
1043 attrName, attrRange, scopeName, scopeLoc, argumentKind, matchingCType,
1044 layoutCompatible, mustBeNull, form);
1055 pool.createTypeAttribute(attrName, attrRange, scopeName, scopeLoc,
1056 typeArg, formUsed, ellipsisLoc);
1068 attrName, attrRange, scopeName, scopeLoc, getterId, setterId, formUsed);
1080 ParsedAttributes &Result);
1132 std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value,
int> = 0>
1142 std::enable_if_t<std::is_same<ACI, AttributeCommonInfo>::value,
int> = 0>
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...
@ TypeTagForDatatypeAllocSize
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, IdentifierLoc *EnvironmentLoc)
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Form form)
AttributeFactory & getFactory() const
ParsedAttr * createPropertyAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Form formUsed)
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, ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form, SourceLocation ellipsisLoc=SourceLocation())
AttributePool & operator=(const AttributePool &)=delete
ParsedAttr * createTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Form form)
AttributePool(const AttributePool &)=delete
AttributePool & operator=(AttributePool &&pool)=delete
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
ParsedAttr * createTypeAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Form formUsed, SourceLocation ellipsisLoc)
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
IdentifierInfo * getMacroIdentifier() const
Return the macro identifier if this attribute was declared in a macro.
const ParsedType & getMatchingCType() const
IdentifierLoc * getArgAsIdent(unsigned Arg) const
ParsedAttr(ParsedAttr &&)=delete
LangAS asSYCLLangAS() const
If this is an OpenCL address space attribute, returns its SYCL representation in LangAS,...
bool hasParsedType() const
const IdentifierLoc * getEnvironment() const
Expr * getArgAsExpr(unsigned Arg) const
void setInvalid(bool b=true) const
ParsedAttr & operator=(ParsedAttr &&)=delete
bool hasMacroIdentifier() const
Returns true if this attribute was declared in a macro.
const ParsedAttrInfo & getInfo() 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,...
SourceLocation getStrictLoc() const
ParsedAttr & operator=(const ParsedAttr &)=delete
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
bool isArgIdent(unsigned Arg) const
IdentifierInfo * getPropertyDataSetter() 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'.
const AvailabilityChange & getAvailabilityObsoleted() const
AttributeCommonInfo::Kind getKind() const
void setProcessingCache(unsigned value) const
const Expr * getMessageExpr() const
SourceLocation getMacroExpansionLoc() const
ParsedAttr(const ParsedAttr &)=delete
bool isArgExpr(unsigned Arg) const
const AvailabilityChange & getAvailabilityDeprecated() const
bool getLayoutCompatible() const
void setUsedAsTypeAttr(bool Used=true)
bool isDeclspecPropertyAttribute() const
Is this the Microsoft __declspec(property) attribute?
const Expr * getReplacementExpr() const
IdentifierInfo * getPropertyDataGetter() const
ArgsUnion getArg(unsigned Arg) const
getArg - Return the specified argument.
SourceLocation getEllipsisLoc() 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...
const AvailabilityChange & getAvailabilityIntroduced() const
void setIsPragmaClangAttribute()
const ParsedType & getTypeArg() const
static const ParsedAttributesView & none()
bool hasMSPropertyAttr() 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 ParsedAttr & operator[](SizeType pos) const
const ParsedAttr & front() const
const_iterator end() const
const ParsedAttr * getMSPropertyAttr() const
void remove(ParsedAttr *ToBeRemoved)
void addAllAtEnd(iterator B, iterator E)
const ParsedAttr & back() const
ParsedAttributes - A collection of parsed attributes.
ParsedAttributes & operator=(const ParsedAttributes &)=delete
void takeOneFrom(ParsedAttributes &Other, ParsedAttr *PA)
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 * addNewPropertyAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Form formUsed)
Add microsoft __delspec(property) attribute.
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, IdentifierLoc *EnvironmentLoc)
Add availability 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.
ParsedAttributes(const ParsedAttributes &)=delete
AttributePool & getPool() const
void takeAllFrom(ParsedAttributes &Other)
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Form form)
Add objc_bridge_related attribute.
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.
ParsedAttributes(AttributeFactory &factory)
ParsedAttributes(ParsedAttributes &&G)=default
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.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
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
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, const IdentifierLoc *EnvironmentLoc)
const IdentifierLoc * EnvironmentLoc
AvailabilityChange Changes[NumAvailabilitySlots]
PropertyData(IdentifierInfo *getterId, IdentifierInfo *setterId)
IdentifierInfo * GetterId
unsigned LayoutCompatible