clang 8.0.0

Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::ParsedAttr Class Referencefinal

ParsedAttr - Represents a syntactic attribute. More...

`#include "clang/Sema/ParsedAttr.h"`

Inheritance diagram for clang::ParsedAttr:
[legend]
Collaboration diagram for clang::ParsedAttr:
[legend]

## Public Types
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 { IgnoredAttribute, UnknownAttribute }

## 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
IdentifierInfo * | getName () const
SourceLocation | getLoc () const
SourceRange | getRange () const
bool | hasScope () const
IdentifierInfo * | getScopeName () const
SourceLocation | getScopeLoc () const
bool | isGNUScope () const
bool | hasParsedType () const
bool | isDeclspecPropertyAttribute () const
| Is this the Microsoft __declspec(property) attribute? More...
bool | isAlignasAttribute () const
bool | isDeclspecAttribute () const
bool | isMicrosoftAttribute () const
bool | isCXX11Attribute () const
bool | isC2xAttribute () const
bool | isKeywordAttribute () const
bool | isContextSensitiveKeywordAttribute () const
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 | isPackExpansion () const
SourceLocation | getEllipsisLoc () const
Kind | getKind () 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
unsigned | getAttributeSpellingListIndex () const
| Get an index into the attribute spelling list defined in Attr.td. 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 | 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...

## Static Public Member Functions
static Kind | getKind (const IdentifierInfo *Name, const IdentifierInfo *Scope, Syntax SyntaxUsed)

## Friends
class | AttributeFactory
class | AttributePool

## Detailed Description

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 117 of file ParsedAttr.h.

## Member Enumeration Documentation

## ◆ Kind

enum clang::ParsedAttr::Kind

Enumerator
IgnoredAttribute |
UnknownAttribute |

Definition at line 370 of file ParsedAttr.h.

## ◆ Syntax

enum clang::ParsedAttr::Syntax

The style used to specify an attribute.

Enumerator
AS_GNU | attribute((...))
AS_CXX11 | [[...]]
AS_C2x | [[...]]
AS_Declspec | __declspec(...)
AS_Microsoft | [uuid("...")] class Foo
AS_Keyword | __ptr16, alignas(...), etc.
AS_Pragma | #pragma ...
AS_ContextSensitiveKeyword | Context-sensitive version of a keyword attribute.

Definition at line 140 of file ParsedAttr.h.

## Constructor & Destructor Documentation

## ◆ ParsedAttr() [1/2]

clang::ParsedAttr::ParsedAttr | ( | const ParsedAttr & |  | ) |
| delete

## ◆ ParsedAttr() [2/2]

clang::ParsedAttr::ParsedAttr | ( | ParsedAttr && |  | ) |
| delete

## ◆ ~ParsedAttr()

clang::ParsedAttr::~ParsedAttr | ( |  | ) |
| delete

## Member Function Documentation

## ◆ appliesToDecl()

bool ParsedAttr::appliesToDecl | ( | const Decl * | D,
|  | attr::SubjectMatchRule | MatchRule
| ) |  | const

Definition at line 212 of file ParsedAttr.cpp.

Referenced by clang::Sema::AddPragmaAttributes().

## ◆ diagnoseAppertainsTo()

bool ParsedAttr::diagnoseAppertainsTo | ( | class Sema & | S,
|  | const Decl * | D
| ) |  | const

Definition at line 208 of file ParsedAttr.cpp.

Referenced by HandleLifetimeBoundAttr().

## ◆ diagnoseLangOpts()

bool ParsedAttr::diagnoseLangOpts | ( | class Sema & | S | ) | const

Definition at line 224 of file ParsedAttr.cpp.

## ◆ existsInTarget()

bool ParsedAttr::existsInTarget | ( | const TargetInfo & | Target | ) | const

Definition at line 236 of file ParsedAttr.cpp.

References ParsedAttrInfo::ExistsInTarget, and getInfo().

## ◆ getArg()

ArgsUnion clang::ParsedAttr::getArg | ( | unsigned | Arg | ) | const
| inline

getArg - Return the specified argument.

Definition at line 451 of file ParsedAttr.h.

## ◆ getArgAsExpr()

Expr* clang::ParsedAttr::getArgAsExpr | ( | unsigned | Arg | ) | const
| inline

Definition at line 460 of file ParsedAttr.h.

Referenced by clang::Sema::checkStringLiteralArgumentAttr(), getCCTypeAttr(), HandleAddressSpaceTypeAttribute(), HandleExtVectorTypeAttr(), HandleNeonVectorTypeAttr(), and HandleVectorSizeAttr().

## ◆ getArgAsIdent()

IdentifierLoc* clang::ParsedAttr::getArgAsIdent | ( | unsigned | Arg | ) | const
| inline

Definition at line 468 of file ParsedAttr.h.

Referenced by clang::Sema::checkStringLiteralArgumentAttr(), getCCTypeAttr(), HandleAddressSpaceTypeAttribute(), HandleExtVectorTypeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), and HandleVectorSizeAttr().

## ◆ getAttributeSpellingListIndex()

unsigned ParsedAttr::getAttributeSpellingListIndex | ( |  | ) | const

Get an index into the attribute spelling list defined in Attr.td.

This index is used by an attribute to pretty print itself.

Definition at line 157 of file ParsedAttr.cpp.

References normalizeAttrScopeName().

Referenced by checkObjCKindOfType(), createSimpleAttr(), getCCTypeAttr(), HandleAddressSpaceTypeAttribute(), handleObjCGCTypeAttr(), and handleObjCOwnershipTypeAttr().

## ◆ getAvailabilityDeprecated()

const AvailabilityChange& clang::ParsedAttr::getAvailabilityDeprecated | ( |  | ) | const
| inline

Definition at line 477 of file ParsedAttr.h.

References clang::detail::DeprecatedSlot, and getKind().

## ◆ getAvailabilityIntroduced()

const AvailabilityChange& clang::ParsedAttr::getAvailabilityIntroduced | ( |  | ) | const
| inline

Definition at line 472 of file ParsedAttr.h.

References getKind(), and clang::detail::IntroducedSlot.

## ◆ getAvailabilityObsoleted()

const AvailabilityChange& clang::ParsedAttr::getAvailabilityObsoleted | ( |  | ) | const
| inline

Definition at line 482 of file ParsedAttr.h.

References getKind(), and clang::detail::ObsoletedSlot.

## ◆ getEllipsisLoc()

SourceLocation clang::ParsedAttr::getEllipsisLoc | ( |  | ) | const
| inline

Definition at line 441 of file ParsedAttr.h.

## ◆ getKind() [1/2]

Kind clang::ParsedAttr::getKind | ( |  | ) | const
| inline

Definition at line 443 of file ParsedAttr.h.

References getKind().

Referenced by attributeParsedArgsUnevaluated(), checkNullabilityTypeSpecifier(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), getCCTypeAttr(), getInfo(), HandleAddressSpaceTypeAttribute(), handleFunctionTypeAttr(), handleMSPointerTypeQualifierAttr(), handleObjCPointerTypeAttr(), clang::ParsedAttributesView::hasAttribute(), and IsBuiltInOrStandardCXX11Attribute().

## ◆ getKind() [2/2]

ParsedAttr::Kind ParsedAttr::getKind | ( | const IdentifierInfo * | Name,
|  | const IdentifierInfo * | Scope,
|  | Syntax | SyntaxUsed
| ) |  |
| static

Definition at line 137 of file ParsedAttr.cpp.

## ◆ getLayoutCompatible()

bool clang::ParsedAttr::getLayoutCompatible | ( |  | ) | const
| inline

Definition at line 513 of file ParsedAttr.h.

References getKind().

## ◆ getLoc()

SourceLocation clang::ParsedAttr::getLoc | ( |  | ) | const
| inline

Definition at line 379 of file ParsedAttr.h.

References clang::SourceRange::getBegin().

Referenced by checkNullabilityTypeSpecifier(), checkObjCKindOfType(), distributeNullabilityTypeAttr(), getAttrLoc(), HandleAddressSpaceTypeAttribute(), HandleExtVectorTypeAttr(), handleFunctionTypeAttr(), handleMSPointerTypeQualifierAttr(), HandleNeonVectorTypeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), HandleOpenCLAccessAttr(), and HandleVectorSizeAttr().

## ◆ getMatchingCType()

const ParsedType& clang::ParsedAttr::getMatchingCType | ( |  | ) | const
| inline

Definition at line 507 of file ParsedAttr.h.

References getKind().

## ◆ getMatchRules()

void ParsedAttr::getMatchRules | ( | const LangOptions & | LangOpts,
|  | SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> & | MatchRules
| ) |  | const

Definition at line 217 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::GetPragmaAttributeMatchRules.

Referenced by clang::Sema::ActOnPragmaAttributeAttribute().

## ◆ getMaxArgs()

unsigned ParsedAttr::getMaxArgs | ( |  | ) | const

Definition at line 200 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::OptArgs.

Referenced by IsBuiltInOrStandardCXX11Attribute().

## ◆ getMessageExpr()

const Expr* clang::ParsedAttr::getMessageExpr | ( |  | ) | const
| inline

Definition at line 497 of file ParsedAttr.h.

References getKind().

## ◆ getMinArgs()

unsigned ParsedAttr::getMinArgs | ( |  | ) | const

Definition at line 198 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::NumArgs.

## ◆ getMustBeNull()

bool clang::ParsedAttr::getMustBeNull | ( |  | ) | const
| inline

Definition at line 519 of file ParsedAttr.h.

References getKind().

## ◆ getName()

IdentifierInfo* clang::ParsedAttr::getName | ( |  | ) | const
| inline

Definition at line 378 of file ParsedAttr.h.

Referenced by clang::Sema::ActOnPragmaAttributeAttribute(), distributeNullabilityTypeAttr(), handleMSPointerTypeQualifierAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), HandleOpenCLAccessAttr(), and clang::operator<<().

## ◆ getNumArgs()

unsigned clang::ParsedAttr::getNumArgs | ( |  | ) | const
| inline

getNumArgs - Return the number of actual arguments to this attribute.

Definition at line 448 of file ParsedAttr.h.

Referenced by getNumAttributeArgs(), HandleAddressSpaceTypeAttribute(), HandleExtVectorTypeAttr(), handleFunctionTypeAttr(), HandleNeonVectorTypeAttr(), handleObjCGCTypeAttr(), and HandleVectorSizeAttr().

## ◆ getProcessingCache()

unsigned clang::ParsedAttr::getProcessingCache | ( |  | ) | const
| inline

Definition at line 427 of file ParsedAttr.h.

## ◆ getPropertyDataGetter()

IdentifierInfo* clang::ParsedAttr::getPropertyDataGetter | ( |  | ) | const
| inline

Definition at line 530 of file ParsedAttr.h.

## ◆ getPropertyDataSetter()

IdentifierInfo* clang::ParsedAttr::getPropertyDataSetter | ( |  | ) | const
| inline

Definition at line 536 of file ParsedAttr.h.

## ◆ getRange()

SourceRange clang::ParsedAttr::getRange | ( |  | ) | const
| inline

Definition at line 380 of file ParsedAttr.h.

Referenced by createSimpleAttr(), getCCTypeAttr(), HandleAddressSpaceTypeAttribute(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), and HandleOpenCLAccessAttr().

## ◆ getReplacementExpr()

const Expr* clang::ParsedAttr::getReplacementExpr | ( |  | ) | const
| inline

Definition at line 502 of file ParsedAttr.h.

References getKind().

## ◆ getScopeLoc()

SourceLocation clang::ParsedAttr::getScopeLoc | ( |  | ) | const
| inline

Definition at line 384 of file ParsedAttr.h.

## ◆ getScopeName()

IdentifierInfo* clang::ParsedAttr::getScopeName | ( |  | ) | const
| inline

Definition at line 383 of file ParsedAttr.h.

## ◆ getSemanticSpelling()

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 246 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::SpellingIndexToSemanticSpelling.

Referenced by HandleOpenCLAccessAttr().

## ◆ getStrictLoc()

SourceLocation clang::ParsedAttr::getStrictLoc | ( |  | ) | const
| inline

Definition at line 487 of file ParsedAttr.h.

References getKind().

## ◆ getTypeArg()

const ParsedType& clang::ParsedAttr::getTypeArg | ( |  | ) | const
| inline

Definition at line 525 of file ParsedAttr.h.

## ◆ getUnavailableLoc()

SourceLocation clang::ParsedAttr::getUnavailableLoc | ( |  | ) | const
| inline

Definition at line 492 of file ParsedAttr.h.

References getKind().

## ◆ hasCustomParsing()

bool ParsedAttr::hasCustomParsing | ( |  | ) | const

Definition at line 204 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::HasCustomParsing.

## ◆ hasParsedType()

bool clang::ParsedAttr::hasParsedType | ( |  | ) | const
| inline

Definition at line 391 of file ParsedAttr.h.

Referenced by getNumAttributeArgs().

## ◆ hasProcessingCache()

bool clang::ParsedAttr::hasProcessingCache | ( |  | ) | const
| inline

Definition at line 425 of file ParsedAttr.h.

## ◆ hasScope()

bool clang::ParsedAttr::hasScope | ( |  | ) | const
| inline

Definition at line 382 of file ParsedAttr.h.

## ◆ hasVariadicArg()

bool ParsedAttr::hasVariadicArg | ( |  | ) | const

Definition at line 250 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::OptArgs.

## ◆ isAlignasAttribute()

bool clang::ParsedAttr::isAlignasAttribute | ( |  | ) | const
| inline

Definition at line 398 of file ParsedAttr.h.

References getKind().

## ◆ isArgExpr()

bool clang::ParsedAttr::isArgExpr | ( | unsigned | Arg | ) | const
| inline

Definition at line 456 of file ParsedAttr.h.

Referenced by getCCTypeAttr().

## ◆ isArgIdent()

bool clang::ParsedAttr::isArgIdent | ( | unsigned | Arg | ) | const
| inline

Definition at line 464 of file ParsedAttr.h.

Referenced by clang::Sema::checkStringLiteralArgumentAttr(), HandleAddressSpaceTypeAttribute(), HandleExtVectorTypeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), and HandleVectorSizeAttr().

## ◆ isC2xAttribute()

bool clang::ParsedAttr::isC2xAttribute | ( |  | ) | const
| inline

Definition at line 410 of file ParsedAttr.h.

## ◆ isContextSensitiveKeywordAttribute()

bool clang::ParsedAttr::isContextSensitiveKeywordAttribute | ( |  | ) | const
| inline

Definition at line 418 of file ParsedAttr.h.

Referenced by checkNullabilityTypeSpecifier(), and distributeNullabilityTypeAttr().

## ◆ isCXX11Attribute()

bool clang::ParsedAttr::isCXX11Attribute | ( |  | ) | const
| inline

Definition at line 406 of file ParsedAttr.h.

Referenced by distributeFunctionTypeAttrFromDeclSpec().

## ◆ isDeclspecAttribute()

bool clang::ParsedAttr::isDeclspecAttribute | ( |  | ) | const
| inline

Definition at line 403 of file ParsedAttr.h.

## ◆ isDeclspecPropertyAttribute()

bool clang::ParsedAttr::isDeclspecPropertyAttribute | ( |  | ) | const
| inline

Is this the Microsoft __declspec(property) attribute?

Definition at line 394 of file ParsedAttr.h.

Referenced by getMSPropertyAttr().

## ◆ isGNUScope()

bool clang::ParsedAttr::isGNUScope | ( |  | ) | const
| inline

Definition at line 386 of file ParsedAttr.h.

References clang::IdentifierInfo::isStr().

## ◆ isInvalid()

bool clang::ParsedAttr::isInvalid | ( |  | ) | const
| inline

Definition at line 422 of file ParsedAttr.h.

Referenced by getCCTypeAttr().

## ◆ isKeywordAttribute()

bool clang::ParsedAttr::isKeywordAttribute | ( |  | ) | const
| inline

Definition at line 414 of file ParsedAttr.h.

## ◆ isKnownToGCC()

bool ParsedAttr::isKnownToGCC | ( |  | ) | const

Definition at line 240 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsKnownToGCC.

## ◆ isMicrosoftAttribute()

bool clang::ParsedAttr::isMicrosoftAttribute | ( |  | ) | const
| inline

Definition at line 404 of file ParsedAttr.h.

## ◆ isPackExpansion()

bool clang::ParsedAttr::isPackExpansion | ( |  | ) | const
| inline

Definition at line 440 of file ParsedAttr.h.

References clang::SourceLocation::isValid().

## ◆ isStmtAttr()

bool ParsedAttr::isStmtAttr | ( |  | ) | const

Definition at line 234 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsStmt.

## ◆ isSupportedByPragmaAttribute()

bool ParsedAttr::isSupportedByPragmaAttribute | ( |  | ) | const

Definition at line 242 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsSupportedByPragmaAttribute.

## ◆ isTargetSpecificAttr()

bool ParsedAttr::isTargetSpecificAttr | ( |  | ) | const

Definition at line 228 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsTargetSpecific.

## ◆ isTypeAttr()

bool ParsedAttr::isTypeAttr | ( |  | ) | const

Definition at line 232 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsType.

## ◆ isUsedAsTypeAttr()

bool clang::ParsedAttr::isUsedAsTypeAttr | ( |  | ) | const
| inline

Definition at line 437 of file ParsedAttr.h.

## ◆ operator delete()

void clang::ParsedAttr::operator delete | ( | void * |  | ) |
| delete

## ◆ operator=() [1/2]

ParsedAttr& clang::ParsedAttr::operator= | ( | const ParsedAttr & |  | ) |
| delete

## ◆ operator=() [2/2]

ParsedAttr& clang::ParsedAttr::operator= | ( | ParsedAttr && |  | ) |
| delete

## ◆ setInvalid()

void clang::ParsedAttr::setInvalid | ( | bool | b = `true` | ) | const
| inline

Definition at line 423 of file ParsedAttr.h.

Referenced by HandleAddressSpaceTypeAttribute(), handleFunctionTypeAttr(), HandleNeonVectorTypeAttr(), handleObjCGCTypeAttr(), handleObjCOwnershipTypeAttr(), HandleOpenCLAccessAttr(), HandleVectorSizeAttr(), and IsBuiltInOrStandardCXX11Attribute().

## ◆ setProcessingCache()

void clang::ParsedAttr::setProcessingCache | ( | unsigned | value | ) | const
| inline

Definition at line 432 of file ParsedAttr.h.

## ◆ setUsedAsTypeAttr()

void clang::ParsedAttr::setUsedAsTypeAttr | ( |  | ) |
| inline

Definition at line 438 of file ParsedAttr.h.

Referenced by createSimpleAttr().

## Friends And Related Function Documentation

## ◆ AttributeFactory

friend class AttributeFactory
| friend

Definition at line 230 of file ParsedAttr.h.

## ◆ AttributePool

friend class AttributePool
| friend

Definition at line 231 of file ParsedAttr.h.

The documentation for this class was generated from the following files:

- include/clang/Sema/ParsedAttr.h
- lib/Sema/ParsedAttr.cpp