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"
87 LLVM_PREFERRED_TYPE(
bool)
89 LLVM_PREFERRED_TYPE(
bool)
96 : GetterId(getterId), SetterId(setterId) {}
103using ArgsUnion = llvm::PointerUnion<Expr *, IdentifierLoc *>;
117 private llvm::TrailingObjects<
118 ParsedAttr, ArgsUnion, detail::AvailabilityData,
119 detail::TypeTagForDatatypeData, ParsedType, detail::PropertyData> {
120 friend TrailingObjects;
122 size_t numTrailingObjects(OverloadToken<ArgsUnion>)
const {
return NumArgs; }
123 size_t numTrailingObjects(OverloadToken<detail::AvailabilityData>)
const {
124 return IsAvailability;
127 numTrailingObjects(OverloadToken<detail::TypeTagForDatatypeData>)
const {
128 return IsTypeTagForDatatype;
130 size_t numTrailingObjects(OverloadToken<ParsedType>)
const {
131 return HasParsedType;
141 unsigned NumArgs : 16;
144 LLVM_PREFERRED_TYPE(
bool)
145 mutable unsigned Invalid : 1;
148 LLVM_PREFERRED_TYPE(
bool)
149 mutable unsigned UsedAsTypeAttr : 1;
153 LLVM_PREFERRED_TYPE(
bool)
154 unsigned IsAvailability : 1;
158 LLVM_PREFERRED_TYPE(
bool)
159 unsigned IsTypeTagForDatatype : 1;
163 LLVM_PREFERRED_TYPE(
bool)
164 unsigned IsProperty : 1;
167 LLVM_PREFERRED_TYPE(
bool)
168 unsigned HasParsedType : 1;
171 LLVM_PREFERRED_TYPE(
bool)
172 mutable unsigned HasProcessingCache : 1;
175 mutable unsigned ProcessingCache : 8;
178 LLVM_PREFERRED_TYPE(
bool)
179 mutable unsigned IsPragmaClangAttribute : 1;
185 const Expr *MessageExpr;
189 ArgsUnion *getArgsBuffer() {
return getTrailingObjects<ArgsUnion>(); }
191 return getTrailingObjects<ArgsUnion>();
195 return getTrailingObjects<detail::AvailabilityData>();
198 return getTrailingObjects<detail::AvailabilityData>();
210 EllipsisLoc(ellipsisLoc), NumArgs(numArgs), Invalid(
false),
213 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
230 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
231 UnavailableLoc(unavailable), MessageExpr(messageExpr),
235 new (getAvailabilityData())
237 replacementExpr, environmentLoc);
241 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
242 AttributeScopeInfo scope, IdentifierLoc *Parm1,
243 IdentifierLoc *Parm2, IdentifierLoc *Parm3, Form formUsed)
244 : AttributeCommonInfo(attrName, scope, attrRange, formUsed), NumArgs(3),
247 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
248 Info(ParsedAttrInfo::get(*this)) {
249 ArgsUnion *Args = getArgsBuffer();
256 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
257 AttributeScopeInfo scope, IdentifierLoc *ArgKind,
258 ParsedType matchingCType,
bool layoutCompatible,
bool mustBeNull,
260 : AttributeCommonInfo(attrName, scope, attrRange, formUsed), NumArgs(1),
262 IsTypeTagForDatatype(
true), IsProperty(
false), HasParsedType(
false),
263 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
264 Info(ParsedAttrInfo::get(*this)) {
266 memcpy(getArgsBuffer(), &PVal,
sizeof(ArgsUnion));
267 detail::TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
268 new (&ExtraData.MatchingCType)
ParsedType(matchingCType);
269 ExtraData.LayoutCompatible = layoutCompatible;
270 ExtraData.MustBeNull = mustBeNull;
274 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
275 AttributeScopeInfo scope, ParsedType typeArg, Form formUsed,
276 SourceLocation ellipsisLoc)
277 : AttributeCommonInfo(attrName, scope, attrRange, formUsed),
280 IsTypeTagForDatatype(
false), IsProperty(
false), HasParsedType(
true),
281 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
282 Info(ParsedAttrInfo::get(*this)) {
287 ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
288 AttributeScopeInfo scope, IdentifierInfo *getterId,
289 IdentifierInfo *setterId, Form formUsed)
290 : AttributeCommonInfo(attrName, scope, attrRange, formUsed), NumArgs(0),
292 IsTypeTagForDatatype(
false), IsProperty(
true), HasParsedType(
false),
293 HasProcessingCache(
false), IsPragmaClangAttribute(
false),
294 Info(ParsedAttrInfo::get(*this)) {
295 new (&getPropertyDataBuffer()) detail::PropertyData(getterId, setterId);
301 detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() {
302 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
304 const detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot()
const {
305 return *getTrailingObjects<detail::TypeTagForDatatypeData>();
310 ParsedType &getTypeBuffer() {
return *getTrailingObjects<ParsedType>(); }
312 return *getTrailingObjects<ParsedType>();
317 detail::PropertyData &getPropertyDataBuffer() {
319 return *getTrailingObjects<detail::PropertyData>();
321 const detail::PropertyData &getPropertyDataBuffer()
const {
323 return *getTrailingObjects<detail::PropertyData>();
326 size_t allocated_size()
const;
335 void operator delete(
void *) =
delete;
350 assert(hasProcessingCache());
351 return ProcessingCache;
355 ProcessingCache = value;
356 HasProcessingCache =
true;
375 assert(Arg < NumArgs &&
"Arg access out of range!");
376 return getArgsBuffer()[Arg];
380 return Arg < NumArgs && isa<Expr *>(getArg(Arg));
386 return Arg < NumArgs && isa<IdentifierLoc *>(getArg(Arg));
390 return cast<IdentifierLoc *>(getArg(Arg));
394 assert(getParsedKind() == AT_Availability &&
395 "Not an availability attribute");
396 return getAvailabilityData()->Changes[detail::IntroducedSlot];
400 assert(getParsedKind() == AT_Availability &&
401 "Not an availability attribute");
402 return getAvailabilityData()->Changes[detail::DeprecatedSlot];
406 assert(getParsedKind() == AT_Availability &&
407 "Not an availability attribute");
408 return getAvailabilityData()->Changes[detail::ObsoletedSlot];
412 assert(getParsedKind() == AT_Availability &&
413 "Not an availability attribute");
414 return getAvailabilityData()->StrictLoc;
418 assert(getParsedKind() == AT_Availability &&
419 "Not an availability attribute");
420 return UnavailableLoc;
424 assert(getParsedKind() == AT_Availability &&
425 "Not an availability attribute");
430 assert(getParsedKind() == AT_Availability &&
431 "Not an availability attribute");
432 return getAvailabilityData()->Replacement;
436 assert(getParsedKind() == AT_Availability &&
437 "Not an availability attribute");
438 return getAvailabilityData()->EnvironmentLoc;
442 assert(getParsedKind() == AT_TypeTagForDatatype &&
443 "Not a type_tag_for_datatype attribute");
444 return getTypeTagForDatatypeDataSlot().MatchingCType;
448 assert(getParsedKind() == AT_TypeTagForDatatype &&
449 "Not a type_tag_for_datatype attribute");
450 return getTypeTagForDatatypeDataSlot().LayoutCompatible;
454 assert(getParsedKind() == AT_TypeTagForDatatype &&
455 "Not a type_tag_for_datatype attribute");
456 return getTypeTagForDatatypeDataSlot().MustBeNull;
460 assert(HasParsedType &&
"Not a type attribute");
461 return getTypeBuffer();
465 assert(isDeclspecPropertyAttribute() &&
466 "Not a __delcspec(property) attribute");
467 return getPropertyDataBuffer().GetterId;
471 assert(isDeclspecPropertyAttribute() &&
472 "Not a __delcspec(property) attribute");
473 return getPropertyDataBuffer().SetterId;
481 MacroExpansionLoc =
Loc;
492 assert(hasMacroIdentifier() &&
"Can only get the macro expansion location "
493 "if this attribute has a macro identifier.");
494 return MacroExpansionLoc;
499 bool checkExactlyNumArgs(
class Sema &S,
unsigned Num)
const;
502 bool checkAtLeastNumArgs(
class Sema &S,
unsigned Num)
const;
505 bool checkAtMostNumArgs(
class Sema &S,
unsigned Num)
const;
507 bool isTargetSpecificAttr()
const;
508 bool isTypeAttr()
const;
509 bool isStmtAttr()
const;
511 bool hasCustomParsing()
const;
512 bool acceptsExprPack()
const;
513 bool isParamExpr(
size_t N)
const;
514 unsigned getMinArgs()
const;
515 unsigned getMaxArgs()
const;
516 unsigned getNumArgMembers()
const;
517 bool hasVariadicArg()
const;
518 void handleAttrWithDelayedArgs(
Sema &S,
Decl *
D)
const;
519 bool diagnoseAppertainsTo(
class Sema &S,
const Decl *
D)
const;
520 bool diagnoseAppertainsTo(
class Sema &S,
const Stmt *St)
const;
521 bool diagnoseMutualExclusion(
class Sema &S,
const Decl *
D)
const;
532 bool diagnoseLangOpts(
class Sema &S)
const;
534 bool isKnownToGCC()
const;
535 bool isSupportedByPragmaAttribute()
const;
547 bool slidesFromDeclToDeclSpecLegacyBehavior()
const;
554 unsigned getSemanticSpelling()
const;
559 switch (getParsedKind()) {
560 case ParsedAttr::AT_OpenCLConstantAddressSpace:
561 return LangAS::opencl_constant;
562 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
563 return LangAS::opencl_global;
564 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
565 return LangAS::opencl_global_device;
566 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
567 return LangAS::opencl_global_host;
568 case ParsedAttr::AT_OpenCLLocalAddressSpace:
569 return LangAS::opencl_local;
570 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
571 return LangAS::opencl_private;
572 case ParsedAttr::AT_OpenCLGenericAddressSpace:
573 return LangAS::opencl_generic;
575 return LangAS::Default;
583 case ParsedAttr::AT_OpenCLGlobalAddressSpace:
584 return LangAS::sycl_global;
585 case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
586 return LangAS::sycl_global_device;
587 case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
588 return LangAS::sycl_global_host;
589 case ParsedAttr::AT_OpenCLLocalAddressSpace:
590 return LangAS::sycl_local;
591 case ParsedAttr::AT_OpenCLPrivateAddressSpace:
592 return LangAS::sycl_private;
593 case ParsedAttr::AT_OpenCLGenericAddressSpace:
595 return LangAS::Default;
602 switch (getParsedKind()) {
603 case ParsedAttr::AT_HLSLGroupSharedAddressSpace:
604 return LangAS::hlsl_groupshared;
606 return LangAS::Default;
625 AvailabilityAllocSize =
629 TypeTagForDatatypeAllocSize =
646 InlineFreeListsCapacity =
647 1 + (AvailabilityAllocSize -
sizeof(
ParsedAttr)) /
sizeof(
void *)
650 llvm::BumpPtrAllocator Alloc;
654 SmallVector<SmallVector<ParsedAttr *, 8>, InlineFreeListsCapacity> FreeLists;
660 void *allocate(
size_t size);
683 void *allocate(
size_t size) {
684 return Factory.allocate(size);
688 Attrs.push_back(attr);
692 void remove(ParsedAttr *attr) {
693 assert(llvm::is_contained(Attrs, attr) &&
694 "Can't take attribute from a pool that doesn't own it!");
695 Attrs.erase(llvm::find(Attrs, attr));
698 void takePool(AttributePool &pool);
721 Factory.reclaimPool(*
this);
739 void *memory = allocate(
744 return add(
new (memory)
ParsedAttr(attrName, attrRange, scope, args,
745 numArgs, form, ellipsisLoc));
755 const Expr *ReplacementExpr,
757 void *memory = allocate(AttributeFactory::AvailabilityAllocSize);
758 return add(
new (memory)
759 ParsedAttr(attrName, attrRange, scope, Param, introduced,
760 deprecated, obsoleted, unavailable, MessageExpr,
761 form, strict, ReplacementExpr, EnvironmentLoc));
768 void *memory = allocate(
772 return add(
new (memory)
ParsedAttr(attrName, attrRange, scope, Param1,
773 Param2, Param3, form));
780 void *memory = allocate(AttributeFactory::TypeTagForDatatypeAllocSize);
781 return add(
new (memory)
ParsedAttr(attrName, attrRange, scope, argumentKind,
782 matchingCType, layoutCompatible,
791 void *memory = allocate(
795 return add(
new (memory)
ParsedAttr(attrName, attrRange, scope, typeArg,
796 formUsed, ellipsisLoc));
803 void *memory = allocate(AttributeFactory::PropertyAllocSize);
804 return add(
new (memory)
ParsedAttr(attrName, attrRange, scope, getterId,
805 setterId, formUsed));
812 using SizeType =
decltype(std::declval<VecTy>().size());
822 bool empty()
const {
return AttrList.empty(); }
823 SizeType
size()
const {
return AttrList.size(); }
829 AttrList.push_back(newAttr);
833 assert(is_contained(AttrList, ToBeRemoved) &&
834 "Cannot remove attribute that isn't in the list");
835 AttrList.erase(llvm::find(AttrList, ToBeRemoved));
840 struct iterator : llvm::iterator_adaptor_base<iterator, VecTy::iterator,
841 std::random_access_iterator_tag,
844 iterator(VecTy::iterator I) : iterator_adaptor_base(I) {}
849 : llvm::iterator_adaptor_base<const_iterator, VecTy::const_iterator,
850 std::random_access_iterator_tag,
860 AttrList.insert(AttrList.begin(), B.I,
E.I);
864 AttrList.insert(AttrList.begin(), B.I,
E.I);
868 AttrList.insert(AttrList.end(), B.I,
E.I);
872 AttrList.insert(AttrList.end(), B.I,
E.I);
882 return *AttrList.front();
886 return *AttrList.front();
890 return *AttrList.back();
894 return *AttrList.back();
898 return llvm::any_of(AttrList, [K](
const ParsedAttr *AL) {
904 auto It = llvm::find_if(AttrList, [](
const ParsedAttr *AL) {
907 if (It != AttrList.end())
919 : StringLiterals(StringLiteralBits) {}
922 if (I >= StringLiterals.size())
923 return StringLiterals.test(StringLiterals.size() - 1);
924 return StringLiterals.test(I);
928 std::bitset<32> StringLiterals;
947 assert(&
Other !=
this &&
948 "ParsedAttributes can't take attributes from itself");
950 Other.clearListOnly();
951 pool.takeAllFrom(
Other.pool);
955 assert(&
Other !=
this &&
956 "ParsedAttributes can't take attributes from itself");
958 Other.clearListOnly();
959 pool.takeAllFrom(
Other.pool);
963 assert(&
Other !=
this &&
964 "ParsedAttributes can't take attribute from itself");
965 Other.getPool().remove(PA);
982 ParsedAttr *
attr = pool.create(attrName, attrRange, scope, args, numArgs,
996 const Expr *ReplacementExpr,
999 pool.create(attrName, attrRange, scope, Param, introduced, deprecated,
1000 obsoleted, unavailable, MessageExpr, form, strict,
1001 ReplacementExpr, EnvironmentLoc);
1012 pool.create(attrName, attrRange, scope, Param1, Param2, Param3, form);
1023 attrName, attrRange, scope, argumentKind, matchingCType,
1024 layoutCompatible, mustBeNull, form);
1034 ParsedAttr *
attr = pool.createTypeAttribute(attrName, attrRange, scope,
1035 typeArg, formUsed, ellipsisLoc);
1046 attrName, attrRange, scope, getterId, setterId, formUsed);
1059 ParsedAttributes &&Second);
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)
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, AttributeScopeInfo scope, ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form, SourceLocation ellipsisLoc=SourceLocation())
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, 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)
AttributePool(AttributePool &&pool)=default
Move the given pool's allocations to this pool.
AttributePool(AttributeFactory &factory)
Create a new pool for a factory.
ParsedAttr * createTypeAttribute(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, ParsedType typeArg, ParsedAttr::Form formUsed, SourceLocation ellipsisLoc)
AttributePool & operator=(AttributePool &&pool)=delete
AttributePool(const AttributePool &)=delete
ParsedAttr * createTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Form form)
AttributeFactory & getFactory() const
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Form form)
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
ParsedAttr * createPropertyAttribute(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Form formUsed)
AttributePool & operator=(const AttributePool &)=delete
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
One of these records is kept for each identifier that is lexed.
A simple pair of identifier info and location.
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
const IdentifierLoc * getEnvironment() 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, AttributeScopeInfo scope, 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.
void takeOneFrom(ParsedAttributes &Other, ParsedAttr *PA)
AttributePool & getPool() const
ParsedAttributes & operator=(const ParsedAttributes &)=delete
ParsedAttr * addNewPropertyAttr(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Form formUsed)
Add microsoft __delspec(property) attribute.
ParsedAttributes(const ParsedAttributes &)=delete
ParsedAttr * addNewTypeAttr(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, ParsedType typeArg, ParsedAttr::Form formUsed, SourceLocation ellipsisLoc=SourceLocation())
Add an attribute with a single type argument.
void takeAllFrom(ParsedAttributes &Other)
void takeAllAtEndFrom(ParsedAttributes &Other)
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Form form)
Add objc_bridge_related attribute.
ParsedAttributes(AttributeFactory &factory)
ParsedAttr * addNewTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Form form)
Add type_tag_for_datatype attribute.
ParsedAttributes(ParsedAttributes &&G)=default
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, AttributeScopeInfo scope, ArgsUnion *args, unsigned numArgs, ParsedAttr::Form form, SourceLocation ellipsisLoc=SourceLocation())
Add attribute with expression arguments.
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.
Exposes information about the current target.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
SubjectMatchRule
A list of all the recognized kinds of attributes.
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
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...
@ ExpectedParameterOrImplicitObjectParameter
@ ExpectedFunctionMethodOrParameter
@ ExpectedFunctionWithProtoType
@ ExpectedFunctionMethodOrBlock
@ ExpectedTypeOrNamespace
@ ExpectedVariableFieldOrTag
@ ExpectedVariableOrField
@ ExpectedForLoopStatement
@ ExpectedFunctionOrMethod
@ ExpectedFunctionOrClassOrEnum
@ ExpectedVariableOrFunction
@ ExpectedFunctionVariableOrClass
@ ExpectedVirtualFunction
@ ExpectedNonMemberFunction
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
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.
void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &&Second)
Consumes the attributes from Second and concatenates them at the end of First.
@ 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.
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