clang  10.0.0svn
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:
Inheritance graph
[legend]
Collaboration diagram for clang::ParsedAttr:
Collaboration graph
[legend]

Public Member Functions

 ParsedAttr (const ParsedAttr &)=delete
 
 ParsedAttr (ParsedAttr &&)=delete
 
ParsedAttroperator= (const ParsedAttr &)=delete
 
ParsedAttroperator= (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
 
ExprgetArgAsExpr (unsigned Arg) const
 
bool isArgIdent (unsigned Arg) const
 
IdentifierLocgetArgAsIdent (unsigned Arg) const
 
const AvailabilityChangegetAvailabilityIntroduced () const
 
const AvailabilityChangegetAvailabilityDeprecated () const
 
const AvailabilityChangegetAvailabilityObsoleted () const
 
SourceLocation getStrictLoc () const
 
SourceLocation getUnavailableLoc () const
 
const ExprgetMessageExpr () const
 
const ExprgetReplacementExpr () const
 
const ParsedTypegetMatchingCType () const
 
bool getLayoutCompatible () const
 
bool getMustBeNull () const
 
const ParsedTypegetTypeArg () const
 
IdentifierInfogetPropertyDataGetter () const
 
IdentifierInfogetPropertyDataSetter () 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...
 
IdentifierInfogetMacroIdentifier () const
 Return the macro identifier if this attribute was declared in a macro. More...
 
SourceLocation getMacroExpansionLoc () const
 
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...
 
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
 
- Public Member Functions inherited from clang::AttributeCommonInfo
 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 IdentifierInfogetAttrName () const
 
SourceLocation getLoc () const
 
SourceRange getRange () const
 
void setRange (SourceRange R)
 
bool hasScope () const
 
const IdentifierInfogetScopeName () const
 
SourceLocation getScopeLoc () const
 
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

- Public Types inherited from clang::AttributeCommonInfo
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 Public Member Functions inherited from clang::AttributeCommonInfo
static Kind getParsedKind (const IdentifierInfo *Name, const IdentifierInfo *Scope, Syntax SyntaxUsed)
 
- Protected Member Functions inherited from clang::AttributeCommonInfo
bool isAttributeSpellingListCalculated () const
 
- Static Protected Attributes inherited from clang::AttributeCommonInfo
static constexpr unsigned SpellingNotCalculated = 0xf
 

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.

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

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

◆ asOpenCLLangAS()

LangAS clang::ParsedAttr::asOpenCLLangAS ( ) const
inline

If this is an OpenCL addr space attribute returns its representation in LangAS, otherwise returns default addr space.

Definition at line 520 of file ParsedAttr.h.

References clang::Default, clang::opencl_constant, clang::opencl_generic, clang::opencl_global, clang::opencl_local, and clang::opencl_private.

Referenced by HandleAddressSpaceTypeAttribute().

◆ diagnoseAppertainsTo()

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

Definition at line 142 of file ParsedAttr.cpp.

Referenced by HandleLifetimeBoundAttr().

◆ diagnoseLangOpts()

bool ParsedAttr::diagnoseLangOpts ( class Sema S) const

Definition at line 158 of file ParsedAttr.cpp.

◆ existsInTarget()

bool ParsedAttr::existsInTarget ( const TargetInfo Target) const

Definition at line 170 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 374 of file ParsedAttr.h.

◆ getArgAsExpr()

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

◆ getArgAsIdent()

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

◆ getAvailabilityDeprecated()

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

Definition at line 401 of file ParsedAttr.h.

References clang::detail::DeprecatedSlot.

◆ getAvailabilityIntroduced()

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

Definition at line 395 of file ParsedAttr.h.

References clang::detail::IntroducedSlot.

◆ getAvailabilityObsoleted()

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

Definition at line 407 of file ParsedAttr.h.

References clang::detail::ObsoletedSlot.

◆ getEllipsisLoc()

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

Definition at line 368 of file ParsedAttr.h.

◆ getKind()

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

◆ getLayoutCompatible()

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

Definition at line 443 of file ParsedAttr.h.

◆ getMacroExpansionLoc()

SourceLocation clang::ParsedAttr::getMacroExpansionLoc ( ) const
inline

Definition at line 487 of file ParsedAttr.h.

◆ getMacroIdentifier()

IdentifierInfo* clang::ParsedAttr::getMacroIdentifier ( ) const
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 485 of file ParsedAttr.h.

◆ getMatchingCType()

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

Definition at line 437 of file ParsedAttr.h.

◆ getMatchRules()

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

◆ getMaxArgs()

unsigned ParsedAttr::getMaxArgs ( ) const

Definition at line 134 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::OptArgs.

Referenced by IsBuiltInOrStandardCXX11Attribute().

◆ getMessageExpr()

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

Definition at line 425 of file ParsedAttr.h.

◆ getMinArgs()

unsigned ParsedAttr::getMinArgs ( ) const

Definition at line 132 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::NumArgs.

◆ getMustBeNull()

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

Definition at line 449 of file ParsedAttr.h.

◆ getNumArgs()

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

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

Definition at line 371 of file ParsedAttr.h.

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

◆ getProcessingCache()

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

Definition at line 349 of file ParsedAttr.h.

◆ getPropertyDataGetter()

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

Definition at line 460 of file ParsedAttr.h.

◆ getPropertyDataSetter()

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

Definition at line 466 of file ParsedAttr.h.

◆ getReplacementExpr()

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

Definition at line 431 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 180 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::SpellingIndexToSemanticSpelling.

Referenced by HandleOpenCLAccessAttr().

◆ getStrictLoc()

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

Definition at line 413 of file ParsedAttr.h.

◆ getTypeArg()

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

Definition at line 455 of file ParsedAttr.h.

◆ getUnavailableLoc()

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

Definition at line 419 of file ParsedAttr.h.

◆ hasCustomParsing()

bool ParsedAttr::hasCustomParsing ( ) const

Definition at line 138 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::HasCustomParsing.

◆ hasMacroIdentifier()

bool clang::ParsedAttr::hasMacroIdentifier ( ) const
inline

Returns true if this attribute was declared in a macro.

Definition at line 481 of file ParsedAttr.h.

◆ hasParsedType()

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

Definition at line 337 of file ParsedAttr.h.

Referenced by getNumAttributeArgs().

◆ hasProcessingCache()

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

Definition at line 347 of file ParsedAttr.h.

◆ hasVariadicArg()

bool ParsedAttr::hasVariadicArg ( ) const

Definition at line 184 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::OptArgs.

◆ isArgExpr()

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

Definition at line 379 of file ParsedAttr.h.

Referenced by getCCTypeAttr().

◆ isArgIdent()

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

◆ isDeclspecPropertyAttribute()

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

Is this the Microsoft __declspec(property) attribute?

Definition at line 340 of file ParsedAttr.h.

Referenced by getMSPropertyAttr().

◆ isInvalid()

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

Definition at line 344 of file ParsedAttr.h.

Referenced by getCCTypeAttr().

◆ isKnownToGCC()

bool ParsedAttr::isKnownToGCC ( ) const

Definition at line 174 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsKnownToGCC.

◆ isPackExpansion()

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

Definition at line 367 of file ParsedAttr.h.

References clang::SourceLocation::isValid().

◆ isPragmaClangAttribute()

bool clang::ParsedAttr::isPragmaClangAttribute ( ) const
inline

True if the attribute is specified using '#pragma clang attribute'.

Definition at line 363 of file ParsedAttr.h.

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

◆ isStmtAttr()

bool ParsedAttr::isStmtAttr ( ) const

Definition at line 168 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsStmt.

◆ isSupportedByPragmaAttribute()

bool ParsedAttr::isSupportedByPragmaAttribute ( ) const

Definition at line 176 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsSupportedByPragmaAttribute.

◆ isTargetSpecificAttr()

bool ParsedAttr::isTargetSpecificAttr ( ) const

Definition at line 162 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsTargetSpecific.

◆ isTypeAttr()

bool ParsedAttr::isTypeAttr ( ) const

Definition at line 166 of file ParsedAttr.cpp.

References getInfo(), and ParsedAttrInfo::IsType.

◆ isUsedAsTypeAttr()

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

Definition at line 359 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

◆ setIsPragmaClangAttribute()

void clang::ParsedAttr::setIsPragmaClangAttribute ( )
inline

Definition at line 365 of file ParsedAttr.h.

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

◆ setMacroIdentifier()

void clang::ParsedAttr::setMacroIdentifier ( IdentifierInfo MacroName,
SourceLocation  Loc 
)
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 475 of file ParsedAttr.h.

◆ setProcessingCache()

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

Definition at line 354 of file ParsedAttr.h.

◆ setUsedAsTypeAttr()

void clang::ParsedAttr::setUsedAsTypeAttr ( bool  Used = true)
inline

Definition at line 360 of file ParsedAttr.h.

References Used.

Referenced by createSimpleAttr().

Friends And Related Function Documentation

◆ AttributeFactory

friend class AttributeFactory
friend

Definition at line 197 of file ParsedAttr.h.

◆ AttributePool

friend class AttributePool
friend

Definition at line 198 of file ParsedAttr.h.


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