clang 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
clang::ParsedAttrInfo Struct Reference

#include "clang/Basic/ParsedAttrInfo.h"

Classes

struct  Spelling
 The syntaxes supported by this attribute and how they're spelled. More...
 

Public Types

enum  AttrHandling { NotHandled , AttributeApplied , AttributeNotApplied }
 

Public Member Functions

virtual ~ParsedAttrInfo ()=default
 
bool hasSpelling (AttributeCommonInfo::Syntax Syntax, StringRef Name) const
 Check if this attribute has specified spelling.
 
virtual bool diagAppertainsToDecl (Sema &S, const ParsedAttr &Attr, const Decl *D) const
 Check if this attribute appertains to D, and issue a diagnostic if not.
 
virtual bool diagAppertainsToStmt (Sema &S, const ParsedAttr &Attr, const Stmt *St) const
 Check if this attribute appertains to St, and issue a diagnostic if not.
 
virtual bool diagMutualExclusion (Sema &S, const ParsedAttr &A, const Decl *D) const
 Check if the given attribute is mutually exclusive with other attributes already applied to the given declaration.
 
virtual bool acceptsLangOpts (const LangOptions &LO) const
 Check if this attribute is allowed by the language we are compiling.
 
virtual bool existsInTarget (const TargetInfo &Target) const
 Check if this attribute is allowed when compiling for the given target.
 
virtual bool spellingExistsInTarget (const TargetInfo &Target, const unsigned SpellingListIndex) const
 Check if this attribute's spelling is allowed when compiling for the given target.
 
virtual unsigned spellingIndexToSemanticSpelling (const ParsedAttr &Attr) const
 Convert the spelling index of Attr to a semantic spelling enum value.
 
virtual bool isParamExpr (size_t N) const
 Returns true if the specified parameter index for this attribute in Attr.td is an ExprArgument or VariadicExprArgument, or a subclass thereof; returns false otherwise.
 
virtual void getPragmaAttributeMatchRules (llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool > > &Rules, const LangOptions &LangOpts) const
 Populate Rules with the match rules of this attribute.
 
virtual AttrHandling handleDeclAttribute (Sema &S, Decl *D, const ParsedAttr &Attr) const
 If this ParsedAttrInfo knows how to handle this ParsedAttr applied to this Decl then do so and return either AttributeApplied if it was applied or AttributeNotApplied if it wasn't.
 

Static Public Member Functions

static const ParsedAttrInfoget (const AttributeCommonInfo &A)
 
static ArrayRef< const ParsedAttrInfo * > getAllBuiltin ()
 

Public Attributes

unsigned AttrKind: 16
 Corresponds to the Kind enum.
 
unsigned NumArgs: 4
 The number of required arguments of this attribute.
 
unsigned OptArgs: 4
 The number of optional arguments of this attributes.
 
unsigned NumArgMembers: 4
 The number of non-fake arguments specified in the attribute definition.
 
unsigned HasCustomParsing: 1
 True if the parsing does not match the semantic content.
 
unsigned AcceptsExprPack: 1
 
unsigned IsTargetSpecific: 1
 True if this attribute is only available for certain targets.
 
unsigned IsType: 1
 True if this attribute applies to types.
 
unsigned IsStmt: 1
 True if this attribute applies to statements.
 
unsigned IsKnownToGCC: 1
 True if this attribute has any spellings that are known to gcc.
 
unsigned IsSupportedByPragmaAttribute: 1
 True if this attribute is supported by #pragma clang attribute.
 
ArrayRef< SpellingSpellings
 
ArrayRef< const char * > ArgNames
 

Protected Member Functions

constexpr ParsedAttrInfo (AttributeCommonInfo::Kind AttrKind=AttributeCommonInfo::NoSemaHandlerAttribute)
 
constexpr ParsedAttrInfo (AttributeCommonInfo::Kind AttrKind, unsigned NumArgs, unsigned OptArgs, unsigned NumArgMembers, unsigned HasCustomParsing, unsigned AcceptsExprPack, unsigned IsTargetSpecific, unsigned IsType, unsigned IsStmt, unsigned IsKnownToGCC, unsigned IsSupportedByPragmaAttribute, ArrayRef< Spelling > Spellings, ArrayRef< const char * > ArgNames)
 

Detailed Description

Definition at line 34 of file ParsedAttrInfo.h.

Member Enumeration Documentation

◆ AttrHandling

Enumerator
NotHandled 
AttributeApplied 
AttributeNotApplied 

Definition at line 149 of file ParsedAttrInfo.h.

Constructor & Destructor Documentation

◆ ParsedAttrInfo() [1/2]

constexpr clang::ParsedAttrInfo::ParsedAttrInfo ( AttributeCommonInfo::Kind  AttrKind = AttributeCommonInfo::NoSemaHandlerAttribute)
inlineconstexprprotected

Definition at line 75 of file ParsedAttrInfo.h.

◆ ParsedAttrInfo() [2/2]

constexpr clang::ParsedAttrInfo::ParsedAttrInfo ( AttributeCommonInfo::Kind  AttrKind,
unsigned  NumArgs,
unsigned  OptArgs,
unsigned  NumArgMembers,
unsigned  HasCustomParsing,
unsigned  AcceptsExprPack,
unsigned  IsTargetSpecific,
unsigned  IsType,
unsigned  IsStmt,
unsigned  IsKnownToGCC,
unsigned  IsSupportedByPragmaAttribute,
ArrayRef< Spelling Spellings,
ArrayRef< const char * >  ArgNames 
)
inlineconstexprprotected

Definition at line 81 of file ParsedAttrInfo.h.

◆ ~ParsedAttrInfo()

virtual clang::ParsedAttrInfo::~ParsedAttrInfo ( )
virtualdefault

Member Function Documentation

◆ acceptsLangOpts()

virtual bool clang::ParsedAttrInfo::acceptsLangOpts ( const LangOptions LO) const
inlinevirtual

Check if this attribute is allowed by the language we are compiling.

Definition at line 123 of file ParsedAttrInfo.h.

◆ diagAppertainsToDecl()

virtual bool clang::ParsedAttrInfo::diagAppertainsToDecl ( Sema S,
const ParsedAttr Attr,
const Decl D 
) const
inlinevirtual

Check if this attribute appertains to D, and issue a diagnostic if not.

Definition at line 107 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::diagnoseAppertainsTo().

◆ diagAppertainsToStmt()

virtual bool clang::ParsedAttrInfo::diagAppertainsToStmt ( Sema S,
const ParsedAttr Attr,
const Stmt St 
) const
inlinevirtual

Check if this attribute appertains to St, and issue a diagnostic if not.

Definition at line 112 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::diagnoseAppertainsTo().

◆ diagMutualExclusion()

virtual bool clang::ParsedAttrInfo::diagMutualExclusion ( Sema S,
const ParsedAttr A,
const Decl D 
) const
inlinevirtual

Check if the given attribute is mutually exclusive with other attributes already applied to the given declaration.

Definition at line 118 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::diagnoseMutualExclusion().

◆ existsInTarget()

virtual bool clang::ParsedAttrInfo::existsInTarget ( const TargetInfo Target) const
inlinevirtual

Check if this attribute is allowed when compiling for the given target.

Definition at line 126 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::existsInTarget().

◆ get()

const ParsedAttrInfo & ParsedAttrInfo::get ( const AttributeCommonInfo A)
static

◆ getAllBuiltin()

ArrayRef< const ParsedAttrInfo * > ParsedAttrInfo::getAllBuiltin ( )
static

Definition at line 144 of file ParsedAttr.cpp.

Referenced by clang::SemaCodeCompletion::CodeCompleteAttribute().

◆ getPragmaAttributeMatchRules()

virtual void clang::ParsedAttrInfo::getPragmaAttributeMatchRules ( llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool > > &  Rules,
const LangOptions LangOpts 
) const
inlinevirtual

Populate Rules with the match rules of this attribute.

Definition at line 145 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::getMatchRules().

◆ handleDeclAttribute()

virtual AttrHandling clang::ParsedAttrInfo::handleDeclAttribute ( Sema S,
Decl D,
const ParsedAttr Attr 
) const
inlinevirtual

If this ParsedAttrInfo knows how to handle this ParsedAttr applied to this Decl then do so and return either AttributeApplied if it was applied or AttributeNotApplied if it wasn't.

Otherwise return NotHandled.

Definition at line 153 of file ParsedAttrInfo.h.

References NotHandled.

Referenced by ProcessDeclAttribute().

◆ hasSpelling()

bool clang::ParsedAttrInfo::hasSpelling ( AttributeCommonInfo::Syntax  Syntax,
StringRef  Name 
) const
inline

Check if this attribute has specified spelling.

Definition at line 100 of file ParsedAttrInfo.h.

References Spellings.

◆ isParamExpr()

virtual bool clang::ParsedAttrInfo::isParamExpr ( size_t  N) const
inlinevirtual

Returns true if the specified parameter index for this attribute in Attr.td is an ExprArgument or VariadicExprArgument, or a subclass thereof; returns false otherwise.

Definition at line 143 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::isParamExpr().

◆ spellingExistsInTarget()

virtual bool clang::ParsedAttrInfo::spellingExistsInTarget ( const TargetInfo Target,
const unsigned  SpellingListIndex 
) const
inlinevirtual

Check if this attribute's spelling is allowed when compiling for the given target.

Definition at line 130 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::existsInTarget().

◆ spellingIndexToSemanticSpelling()

virtual unsigned clang::ParsedAttrInfo::spellingIndexToSemanticSpelling ( const ParsedAttr Attr) const
inlinevirtual

Convert the spelling index of Attr to a semantic spelling enum value.

Definition at line 137 of file ParsedAttrInfo.h.

References UINT_MAX.

Referenced by clang::ParsedAttr::getSemanticSpelling().

Member Data Documentation

◆ AcceptsExprPack

unsigned clang::ParsedAttrInfo::AcceptsExprPack

Definition at line 49 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::acceptsExprPack().

◆ ArgNames

ArrayRef<const char *> clang::ParsedAttrInfo::ArgNames

Definition at line 72 of file ParsedAttrInfo.h.

◆ AttrKind

unsigned clang::ParsedAttrInfo::AttrKind

Corresponds to the Kind enum.

Definition at line 37 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::getKind().

◆ HasCustomParsing

unsigned clang::ParsedAttrInfo::HasCustomParsing

True if the parsing does not match the semantic content.

Definition at line 46 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::hasCustomParsing().

◆ IsKnownToGCC

unsigned clang::ParsedAttrInfo::IsKnownToGCC

True if this attribute has any spellings that are known to gcc.

Definition at line 61 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::isKnownToGCC().

◆ IsStmt

unsigned clang::ParsedAttrInfo::IsStmt

True if this attribute applies to statements.

Definition at line 58 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::isStmtAttr().

◆ IsSupportedByPragmaAttribute

unsigned clang::ParsedAttrInfo::IsSupportedByPragmaAttribute

True if this attribute is supported by #pragma clang attribute.

Definition at line 64 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::isSupportedByPragmaAttribute().

◆ IsTargetSpecific

unsigned clang::ParsedAttrInfo::IsTargetSpecific

True if this attribute is only available for certain targets.

Definition at line 52 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::isTargetSpecificAttr().

◆ IsType

unsigned clang::ParsedAttrInfo::IsType

True if this attribute applies to types.

Definition at line 55 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::isTypeAttr().

◆ NumArgMembers

unsigned clang::ParsedAttrInfo::NumArgMembers

The number of non-fake arguments specified in the attribute definition.

Definition at line 43 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::getNumArgMembers().

◆ NumArgs

unsigned clang::ParsedAttrInfo::NumArgs

The number of required arguments of this attribute.

Definition at line 39 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::getMinArgs().

◆ OptArgs

unsigned clang::ParsedAttrInfo::OptArgs

The number of optional arguments of this attributes.

Definition at line 41 of file ParsedAttrInfo.h.

Referenced by clang::ParsedAttr::getMaxArgs(), and clang::ParsedAttr::hasVariadicArg().

◆ Spellings

ArrayRef<Spelling> clang::ParsedAttrInfo::Spellings

Definition at line 70 of file ParsedAttrInfo.h.

Referenced by hasSpelling().


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