clang  6.0.0svn
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::AttributeList Class Reference

AttributeList - Represents a syntactic attribute. More...

#include "clang/Sema/AttributeList.h"

Classes

struct  PropertyData
 
struct  TypeTagForDatatypeData
 

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

IdentifierInfogetName () const
 
SourceLocation getLoc () const
 
SourceRange getRange () const
 
bool hasScope () const
 
IdentifierInfogetScopeName () const
 
SourceLocation getScopeLoc () 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
 
AttributeListgetNext () const
 
void setNext (AttributeList *N)
 
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
 
const PropertyDatagetPropertyData () 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 AttributePool
 
class AttributeFactory
 

Detailed Description

AttributeList - 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 95 of file AttributeList.h.

Member Enumeration Documentation

◆ Kind

Enumerator
IgnoredAttribute 
UnknownAttribute 

Definition at line 350 of file AttributeList.h.

◆ 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 98 of file AttributeList.h.

Member Function Documentation

◆ appliesToDecl()

bool AttributeList::appliesToDecl ( const Decl D,
attr::SubjectMatchRule  MatchRule 
) const

Definition at line 201 of file AttributeList.cpp.

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

◆ diagnoseAppertainsTo()

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

Definition at line 197 of file AttributeList.cpp.

◆ diagnoseLangOpts()

bool AttributeList::diagnoseLangOpts ( class Sema S) const

Definition at line 213 of file AttributeList.cpp.

◆ existsInTarget()

bool AttributeList::existsInTarget ( const TargetInfo Target) const

◆ getArg()

ArgsUnion clang::AttributeList::getArg ( unsigned  Arg) const
inline

getArg - Return the specified argument.

Definition at line 424 of file AttributeList.h.

◆ getArgAsExpr()

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

◆ getArgAsIdent()

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

◆ getAttributeSpellingListIndex()

unsigned AttributeList::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 146 of file AttributeList.cpp.

◆ getAvailabilityDeprecated()

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

Definition at line 448 of file AttributeList.h.

References getKind().

◆ getAvailabilityIntroduced()

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

Definition at line 443 of file AttributeList.h.

References getKind().

◆ getAvailabilityObsoleted()

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

Definition at line 453 of file AttributeList.h.

References getKind().

◆ getEllipsisLoc()

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

Definition at line 411 of file AttributeList.h.

◆ getKind() [1/2]

Kind clang::AttributeList::getKind ( ) const
inline

◆ getKind() [2/2]

AttributeList::Kind AttributeList::getKind ( const IdentifierInfo Name,
const IdentifierInfo Scope,
Syntax  SyntaxUsed 
)
static

Definition at line 126 of file AttributeList.cpp.

◆ getLayoutCompatible()

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

Definition at line 484 of file AttributeList.h.

References getKind().

◆ getLoc()

SourceLocation clang::AttributeList::getLoc ( ) const
inline

◆ getMatchingCType()

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

Definition at line 478 of file AttributeList.h.

References getKind().

◆ getMatchRules()

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

◆ getMaxArgs()

unsigned AttributeList::getMaxArgs ( ) const

Definition at line 189 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::OptArgs.

Referenced by IsBuiltInOrStandardCXX11Attribute().

◆ getMessageExpr()

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

Definition at line 468 of file AttributeList.h.

References getKind().

◆ getMinArgs()

unsigned AttributeList::getMinArgs ( ) const

Definition at line 185 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::NumArgs.

◆ getMustBeNull()

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

Definition at line 490 of file AttributeList.h.

References getKind().

◆ getName()

IdentifierInfo* clang::AttributeList::getName ( ) const
inline

◆ getNext()

AttributeList* clang::AttributeList::getNext ( ) const
inline

◆ getNumArgs()

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

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

Definition at line 421 of file AttributeList.h.

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

◆ getProcessingCache()

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

Definition at line 398 of file AttributeList.h.

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

◆ getPropertyData()

const PropertyData& clang::AttributeList::getPropertyData ( ) const
inline

Definition at line 501 of file AttributeList.h.

◆ getRange()

SourceRange clang::AttributeList::getRange ( ) const
inline

Definition at line 360 of file AttributeList.h.

Referenced by clang::Declarator::getCXX11AttributeRanges().

◆ getReplacementExpr()

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

Definition at line 473 of file AttributeList.h.

References getKind().

◆ getScopeLoc()

SourceLocation clang::AttributeList::getScopeLoc ( ) const
inline

Definition at line 364 of file AttributeList.h.

◆ getScopeName()

IdentifierInfo* clang::AttributeList::getScopeName ( ) const
inline

Definition at line 363 of file AttributeList.h.

Referenced by processTypeAttrs().

◆ getSemanticSpelling()

unsigned AttributeList::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 241 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::SpellingIndexToSemanticSpelling.

Referenced by HandleOpenCLAccessAttr().

◆ getStrictLoc()

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

Definition at line 458 of file AttributeList.h.

References getKind().

◆ getTypeArg()

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

Definition at line 496 of file AttributeList.h.

◆ getUnavailableLoc()

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

Definition at line 463 of file AttributeList.h.

References getKind().

◆ hasCustomParsing()

bool AttributeList::hasCustomParsing ( ) const

Definition at line 193 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::HasCustomParsing.

◆ hasParsedType()

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

Definition at line 366 of file AttributeList.h.

Referenced by getNumAttributeArgs().

◆ hasProcessingCache()

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

Definition at line 397 of file AttributeList.h.

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

◆ hasScope()

bool clang::AttributeList::hasScope ( ) const
inline

Definition at line 362 of file AttributeList.h.

◆ hasVariadicArg()

bool AttributeList::hasVariadicArg ( ) const

Definition at line 245 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::OptArgs.

◆ isAlignasAttribute()

bool clang::AttributeList::isAlignasAttribute ( ) const
inline

Definition at line 373 of file AttributeList.h.

References getKind().

◆ isArgExpr()

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

Definition at line 429 of file AttributeList.h.

Referenced by fillAttributedTypeLoc(), and getCCTypeAttrKind().

◆ isArgIdent()

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

◆ isC2xAttribute()

bool clang::AttributeList::isC2xAttribute ( ) const
inline

Definition at line 383 of file AttributeList.h.

◆ isContextSensitiveKeywordAttribute()

bool clang::AttributeList::isContextSensitiveKeywordAttribute ( ) const
inline

Definition at line 390 of file AttributeList.h.

Referenced by distributeNullabilityTypeAttr(), and processTypeAttrs().

◆ isCXX11Attribute()

bool clang::AttributeList::isCXX11Attribute ( ) const
inline

◆ isDeclspecAttribute()

bool clang::AttributeList::isDeclspecAttribute ( ) const
inline

Definition at line 378 of file AttributeList.h.

◆ isDeclspecPropertyAttribute()

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

Is this the Microsoft __declspec(property) attribute?

Definition at line 369 of file AttributeList.h.

◆ isInvalid()

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

◆ isKeywordAttribute()

bool clang::AttributeList::isKeywordAttribute ( ) const
inline

Definition at line 386 of file AttributeList.h.

◆ isKnownToGCC()

bool AttributeList::isKnownToGCC ( ) const

Definition at line 233 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::IsKnownToGCC.

Referenced by clang::Parser::ParseTopLevelDecl().

◆ isMicrosoftAttribute()

bool clang::AttributeList::isMicrosoftAttribute ( ) const
inline

Definition at line 379 of file AttributeList.h.

◆ isPackExpansion()

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

Definition at line 410 of file AttributeList.h.

References clang::SourceLocation::isValid().

◆ isStmtAttr()

bool AttributeList::isStmtAttr ( ) const

Definition at line 225 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::IsStmt.

◆ isSupportedByPragmaAttribute()

bool AttributeList::isSupportedByPragmaAttribute ( ) const

Definition at line 237 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::IsSupportedByPragmaAttribute.

◆ isTargetSpecificAttr()

bool AttributeList::isTargetSpecificAttr ( ) const

Definition at line 217 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::IsTargetSpecific.

◆ isTypeAttr()

bool AttributeList::isTypeAttr ( ) const

Definition at line 221 of file AttributeList.cpp.

References getInfo(), and ParsedAttrInfo::IsType.

◆ isUsedAsTypeAttr()

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

Definition at line 407 of file AttributeList.h.

Referenced by takeDeclAttributes().

◆ setInvalid()

void clang::AttributeList::setInvalid ( bool  b = true) const
inline

◆ setNext()

void clang::AttributeList::setNext ( AttributeList N)
inline

◆ setProcessingCache()

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

Definition at line 402 of file AttributeList.h.

◆ setUsedAsTypeAttr()

void clang::AttributeList::setUsedAsTypeAttr ( )
inline

Definition at line 408 of file AttributeList.h.

Referenced by processTypeAttrs().

Friends And Related Function Documentation

◆ AttributeFactory

friend class AttributeFactory
friend

Definition at line 347 of file AttributeList.h.

◆ AttributePool

friend class AttributePool
friend

Definition at line 346 of file AttributeList.h.


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