clang
13.0.0git
|
ParsedAttr - Represents a syntactic attribute. More...
#include "clang/Sema/ParsedAttr.h"
Public Member Functions | |
ParsedAttr (const ParsedAttr &)=delete | |
ParsedAttr (ParsedAttr &&)=delete | |
ParsedAttr & | operator= (const ParsedAttr &)=delete |
ParsedAttr & | operator= (ParsedAttr &&)=delete |
~ParsedAttr ()=delete | |
void | operator delete (void *)=delete |
bool | hasParsedType () const |
bool | isDeclspecPropertyAttribute () const |
Is this the Microsoft __declspec(property) attribute? More... | |
bool | isInvalid () const |
void | setInvalid (bool b=true) const |
bool | hasProcessingCache () const |
unsigned | getProcessingCache () const |
void | setProcessingCache (unsigned value) const |
bool | isUsedAsTypeAttr () const |
void | setUsedAsTypeAttr (bool Used=true) |
bool | isPragmaClangAttribute () const |
True if the attribute is specified using '#pragma clang attribute'. More... | |
void | setIsPragmaClangAttribute () |
bool | isPackExpansion () const |
SourceLocation | getEllipsisLoc () const |
unsigned | getNumArgs () const |
getNumArgs - Return the number of actual arguments to this attribute. More... | |
ArgsUnion | getArg (unsigned Arg) const |
getArg - Return the specified argument. More... | |
bool | isArgExpr (unsigned Arg) const |
Expr * | getArgAsExpr (unsigned Arg) const |
bool | isArgIdent (unsigned Arg) const |
IdentifierLoc * | getArgAsIdent (unsigned Arg) const |
const AvailabilityChange & | getAvailabilityIntroduced () const |
const AvailabilityChange & | getAvailabilityDeprecated () const |
const AvailabilityChange & | getAvailabilityObsoleted () const |
SourceLocation | getStrictLoc () const |
SourceLocation | getUnavailableLoc () const |
const Expr * | getMessageExpr () const |
const Expr * | getReplacementExpr () const |
const ParsedType & | getMatchingCType () const |
bool | getLayoutCompatible () const |
bool | getMustBeNull () const |
const ParsedType & | getTypeArg () const |
IdentifierInfo * | getPropertyDataGetter () const |
IdentifierInfo * | getPropertyDataSetter () 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 a macro. More... | |
bool | hasMacroIdentifier () const |
Returns true if this attribute was declared in a macro. More... | |
IdentifierInfo * | getMacroIdentifier () const |
Return the macro identifier if this attribute was declared in a macro. More... | |
SourceLocation | getMacroExpansionLoc () const |
bool | checkExactlyNumArgs (class Sema &S, unsigned Num) const |
Check if the attribute has exactly as many args as Num. More... | |
bool | checkAtLeastNumArgs (class Sema &S, unsigned Num) const |
Check if the attribute has at least as many args as Num. More... | |
bool | checkAtMostNumArgs (class Sema &S, unsigned Num) const |
Check if the attribute has at most as many args as Num. More... | |
bool | isTargetSpecificAttr () const |
bool | isTypeAttr () const |
bool | isStmtAttr () const |
bool | hasCustomParsing () const |
unsigned | getMinArgs () const |
unsigned | getMaxArgs () const |
bool | hasVariadicArg () const |
bool | diagnoseAppertainsTo (class Sema &S, const Decl *D) const |
bool | diagnoseAppertainsTo (class Sema &S, const Stmt *St) const |
bool | diagnoseMutualExclusion (class Sema &S, const Decl *D) const |
bool | diagnoseMutualExclusion (class Sema &S, const Stmt *St) const |
bool | appliesToDecl (const Decl *D, attr::SubjectMatchRule MatchRule) const |
void | getMatchRules (const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &MatchRules) const |
bool | diagnoseLangOpts (class Sema &S) const |
bool | existsInTarget (const TargetInfo &Target) const |
bool | isKnownToGCC () const |
bool | isSupportedByPragmaAttribute () const |
unsigned | getSemanticSpelling () const |
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration (due to having semantically-distinct spelling variations), return the value of that semantic spelling. More... | |
LangAS | asOpenCLLangAS () const |
If this is an OpenCL addr space attribute returns its representation in LangAS, otherwise returns default addr space. More... | |
AttributeCommonInfo::Kind | getKind () const |
const ParsedAttrInfo & | getInfo () const |
![]() | |
AttributeCommonInfo (SourceRange AttrRange) | |
AttributeCommonInfo (SourceLocation AttrLoc) | |
AttributeCommonInfo (const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Syntax SyntaxUsed) | |
AttributeCommonInfo (const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Kind AttrKind, Syntax SyntaxUsed) | |
AttributeCommonInfo (const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Kind AttrKind, Syntax SyntaxUsed, unsigned Spelling) | |
AttributeCommonInfo (const IdentifierInfo *AttrName, SourceRange AttrRange, Syntax SyntaxUsed) | |
AttributeCommonInfo (SourceRange AttrRange, Kind K, Syntax SyntaxUsed) | |
AttributeCommonInfo (SourceRange AttrRange, Kind K, Syntax SyntaxUsed, unsigned Spelling) | |
AttributeCommonInfo (AttributeCommonInfo &&)=default | |
AttributeCommonInfo (const AttributeCommonInfo &)=default | |
Kind | getParsedKind () const |
Syntax | getSyntax () const |
const IdentifierInfo * | getAttrName () const |
SourceLocation | getLoc () const |
SourceRange | getRange () const |
void | setRange (SourceRange R) |
bool | hasScope () const |
const IdentifierInfo * | getScopeName () const |
SourceLocation | getScopeLoc () const |
std::string | getNormalizedFullName () const |
Gets the normalized full name, which consists of both scope and name and with surrounding underscores removed as appropriate (e.g. More... | |
bool | isDeclspecAttribute () const |
bool | isMicrosoftAttribute () const |
bool | isGNUScope () const |
bool | isAlignasAttribute () const |
bool | isCXX11Attribute () const |
bool | isC2xAttribute () const |
bool | isKeywordAttribute () const |
bool | isContextSensitiveKeywordAttribute () const |
unsigned | getAttributeSpellingListIndex () const |
void | setAttributeSpellingListIndex (unsigned V) |
Friends | |
class | AttributeFactory |
class | AttributePool |
Additional Inherited Members | |
![]() | |
enum | Syntax { AS_GNU, AS_CXX11, AS_C2x, AS_Declspec, AS_Microsoft, AS_Keyword, AS_Pragma, AS_ContextSensitiveKeyword } |
The style used to specify an attribute. More... | |
enum | Kind { NoSemaHandlerAttribute, IgnoredAttribute, UnknownAttribute } |
![]() | |
static Kind | getParsedKind (const IdentifierInfo *Name, const IdentifierInfo *Scope, Syntax SyntaxUsed) |
![]() | |
bool | isAttributeSpellingListCalculated () const |
![]() | |
static constexpr unsigned | SpellingNotCalculated = 0xf |
ParsedAttr - Represents a syntactic attribute.
For a GNU attribute, there are four forms of this construct:
1: attribute(( const )). ParmName/Args/NumArgs will all be unused. 2: attribute(( mode(byte) )). ParmName used, Args/NumArgs unused. 3: attribute(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used. 4: attribute(( aligned(16) )). ParmName is unused, Args/Num used.
Definition at line 214 of file ParsedAttr.h.
|
delete |
|
delete |
|
delete |
bool ParsedAttr::appliesToDecl | ( | const Decl * | D, |
attr::SubjectMatchRule | MatchRule | ||
) | const |
Definition at line 174 of file ParsedAttr.cpp.
|
inline |
If this is an OpenCL addr space attribute returns its representation in LangAS, otherwise returns default addr space.
Definition at line 634 of file ParsedAttr.h.
References clang::Default, clang::AttributeCommonInfo::getParsedKind(), clang::opencl_constant, clang::opencl_generic, clang::opencl_global, clang::opencl_global_device, clang::opencl_global_host, clang::opencl_local, and clang::opencl_private.
Check if the attribute has at least as many args as Num.
May output an error. Returns false if a diagnostic is produced.
Definition at line 241 of file ParsedAttr.cpp.
Check if the attribute has at most as many args as Num.
May output an error. Returns false if a diagnostic is produced.
Definition at line 246 of file ParsedAttr.cpp.
Check if the attribute has exactly as many args as Num.
May output an error. Returns false if a diagnostic is produced.
Definition at line 236 of file ParsedAttr.cpp.
Referenced by clang::Sema::CheckAttrNoArgs(), clang::Sema::CheckCallingConvAttr(), and clang::Sema::CheckRegparmAttr().
Definition at line 158 of file ParsedAttr.cpp.
Definition at line 162 of file ParsedAttr.cpp.
Definition at line 186 of file ParsedAttr.cpp.
Definition at line 166 of file ParsedAttr.cpp.
Definition at line 170 of file ParsedAttr.cpp.
bool ParsedAttr::existsInTarget | ( | const TargetInfo & | Target | ) | const |
Definition at line 198 of file ParsedAttr.cpp.
References clang::ParsedAttrInfo::existsInTarget(), getInfo(), and clang::Target.
Referenced by clang::Sema::CheckAttrTarget().
getArg - Return the specified argument.
Definition at line 475 of file ParsedAttr.h.
Referenced by getArgAsExpr(), getArgAsIdent(), isArgExpr(), and isArgIdent().
Definition at line 484 of file ParsedAttr.h.
References getArg().
Referenced by clang::Sema::CheckRegparmAttr(), and clang::Sema::checkStringLiteralArgumentAttr().
|
inline |
Definition at line 492 of file ParsedAttr.h.
References getArg().
Referenced by clang::Sema::checkStringLiteralArgumentAttr().
|
inline |
Definition at line 502 of file ParsedAttr.h.
References clang::detail::AvailabilityData::Changes, clang::detail::DeprecatedSlot, and clang::AttributeCommonInfo::getParsedKind().
|
inline |
Definition at line 496 of file ParsedAttr.h.
References clang::detail::AvailabilityData::Changes, clang::AttributeCommonInfo::getParsedKind(), and clang::detail::IntroducedSlot.
|
inline |
Definition at line 508 of file ParsedAttr.h.
References clang::detail::AvailabilityData::Changes, clang::AttributeCommonInfo::getParsedKind(), and clang::detail::ObsoletedSlot.
|
inline |
Definition at line 469 of file ParsedAttr.h.
|
inline |
Definition at line 658 of file ParsedAttr.h.
Referenced by existsInTarget(), getMatchRules(), getMaxArgs(), getMinArgs(), getSemanticSpelling(), hasCustomParsing(), hasVariadicArg(), isKnownToGCC(), isStmtAttr(), isSupportedByPragmaAttribute(), isTargetSpecificAttr(), and isTypeAttr().
|
inline |
Definition at line 655 of file ParsedAttr.h.
References clang::ParsedAttrInfo::AttrKind.
Referenced by clang::Sema::CheckCallingConvAttr(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), handleObjCPointerTypeAttr(), isAddressSpaceKind(), and parsedAttrToRetainOwnershipKind().
|
inline |
Definition at line 544 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind(), and clang::detail::TypeTagForDatatypeData::LayoutCompatible.
|
inline |
Definition at line 588 of file ParsedAttr.h.
References hasMacroIdentifier().
|
inline |
Return the macro identifier if this attribute was declared in a macro.
nullptr is returned if it was not declared in a macro.
Definition at line 586 of file ParsedAttr.h.
|
inline |
Definition at line 538 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind(), and clang::detail::TypeTagForDatatypeData::MatchingCType.
void ParsedAttr::getMatchRules | ( | const LangOptions & | LangOpts, |
SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> & | MatchRules | ||
) | const |
Definition at line 179 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::getPragmaAttributeMatchRules().
Referenced by clang::Sema::ActOnPragmaAttributeAttribute().
unsigned ParsedAttr::getMaxArgs | ( | ) | const |
Definition at line 150 of file ParsedAttr.cpp.
References getInfo(), getMinArgs(), and clang::ParsedAttrInfo::OptArgs.
|
inline |
Definition at line 526 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind().
unsigned ParsedAttr::getMinArgs | ( | ) | const |
Definition at line 148 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::NumArgs.
Referenced by getMaxArgs().
|
inline |
Definition at line 550 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind(), and clang::detail::TypeTagForDatatypeData::MustBeNull.
|
inline |
getNumArgs - Return the number of actual arguments to this attribute.
Definition at line 472 of file ParsedAttr.h.
Referenced by getNumAttributeArgs().
|
inline |
Definition at line 450 of file ParsedAttr.h.
References hasProcessingCache().
Referenced by clang::Sema::CheckCallingConvAttr().
|
inline |
Definition at line 561 of file ParsedAttr.h.
References clang::detail::PropertyData::GetterId, and isDeclspecPropertyAttribute().
|
inline |
Definition at line 567 of file ParsedAttr.h.
References isDeclspecPropertyAttribute(), and clang::detail::PropertyData::SetterId.
|
inline |
Definition at line 532 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind(), and clang::detail::AvailabilityData::Replacement.
unsigned ParsedAttr::getSemanticSpelling | ( | ) | const |
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration (due to having semantically-distinct spelling variations), return the value of that semantic spelling.
If the parsed attribute does not have a semantic equivalent, or would not have a Spelling enumeration, the value UINT_MAX is returned.
Definition at line 208 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::spellingIndexToSemanticSpelling().
|
inline |
Definition at line 514 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind(), and clang::detail::AvailabilityData::StrictLoc.
|
inline |
Definition at line 556 of file ParsedAttr.h.
|
inline |
Definition at line 520 of file ParsedAttr.h.
References clang::AttributeCommonInfo::getParsedKind().
bool ParsedAttr::hasCustomParsing | ( | ) | const |
Definition at line 154 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::HasCustomParsing.
|
inline |
Returns true if this attribute was declared in a macro.
Definition at line 582 of file ParsedAttr.h.
Referenced by getMacroExpansionLoc().
|
inline |
Definition at line 438 of file ParsedAttr.h.
Referenced by getNumAttributeArgs().
|
inline |
Definition at line 448 of file ParsedAttr.h.
Referenced by clang::Sema::CheckCallingConvAttr(), and getProcessingCache().
bool ParsedAttr::hasVariadicArg | ( | ) | const |
Definition at line 212 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::OptArgs.
Definition at line 480 of file ParsedAttr.h.
References getArg().
Definition at line 488 of file ParsedAttr.h.
References getArg().
Referenced by clang::Sema::checkStringLiteralArgumentAttr().
|
inline |
Is this the Microsoft __declspec(property) attribute?
Definition at line 441 of file ParsedAttr.h.
Referenced by getMSPropertyAttr(), getPropertyDataGetter(), and getPropertyDataSetter().
|
inline |
Definition at line 445 of file ParsedAttr.h.
Referenced by clang::Sema::CheckCallingConvAttr(), and clang::Sema::CheckRegparmAttr().
bool ParsedAttr::isKnownToGCC | ( | ) | const |
Definition at line 202 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::IsKnownToGCC.
|
inline |
Definition at line 468 of file ParsedAttr.h.
References clang::SourceLocation::isValid().
|
inline |
True if the attribute is specified using '#pragma clang attribute'.
Definition at line 464 of file ParsedAttr.h.
bool ParsedAttr::isStmtAttr | ( | ) | const |
Definition at line 196 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::IsStmt.
bool ParsedAttr::isSupportedByPragmaAttribute | ( | ) | const |
Definition at line 204 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::IsSupportedByPragmaAttribute.
bool ParsedAttr::isTargetSpecificAttr | ( | ) | const |
Definition at line 190 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::IsTargetSpecific.
bool ParsedAttr::isTypeAttr | ( | ) | const |
Definition at line 194 of file ParsedAttr.cpp.
References getInfo(), and clang::ParsedAttrInfo::IsType.
|
inline |
Definition at line 460 of file ParsedAttr.h.
|
delete |
|
delete |
|
delete |
Definition at line 446 of file ParsedAttr.h.
References b.
Referenced by clang::Sema::CheckAttrNoArgs(), clang::Sema::CheckAttrTarget(), clang::Sema::CheckCallingConvAttr(), and clang::Sema::CheckRegparmAttr().
|
inline |
Definition at line 466 of file ParsedAttr.h.
Referenced by clang::Sema::ActOnPragmaAttributeAttribute().
|
inline |
Set the macro identifier info object that this parsed attribute was declared in if it was declared in a macro.
Also set the expansion location of the macro.
Definition at line 576 of file ParsedAttr.h.
|
inline |
Definition at line 455 of file ParsedAttr.h.
Referenced by clang::Sema::CheckCallingConvAttr().
|
friend |
Definition at line 296 of file ParsedAttr.h.
|
friend |
Definition at line 297 of file ParsedAttr.h.