clang  16.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/Sema/ParsedAttr.h"

Collaboration diagram for clang::ParsedAttrInfo:
Collaboration graph
[legend]

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
 
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. More...
 
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. More...
 
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. More...
 
virtual bool acceptsLangOpts (const LangOptions &LO) const
 Check if this attribute is allowed by the language we are compiling. More...
 
virtual bool existsInTarget (const TargetInfo &Target) const
 Check if this attribute is allowed when compiling for the given target. More...
 
virtual unsigned spellingIndexToSemanticSpelling (const ParsedAttr &Attr) const
 Convert the spelling index of Attr to a semantic spelling enum value. More...
 
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. More...
 
virtual void getPragmaAttributeMatchRules (llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &Rules, const LangOptions &LangOpts) const
 Populate Rules with the match rules of this attribute. More...
 
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. More...
 

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. More...
 
unsigned NumArgs: 4
 The number of required arguments of this attribute. More...
 
unsigned OptArgs: 4
 The number of optional arguments of this attributes. More...
 
unsigned NumArgMembers: 4
 The number of non-fake arguments specified in the attribute definition. More...
 
unsigned HasCustomParsing: 1
 True if the parsing does not match the semantic content. More...
 
unsigned AcceptsExprPack: 1
 
unsigned IsTargetSpecific: 1
 True if this attribute is only available for certain targets. More...
 
unsigned IsType: 1
 True if this attribute applies to types. More...
 
unsigned IsStmt: 1
 True if this attribute applies to statements. More...
 
unsigned IsKnownToGCC: 1
 True if this attribute has any spellings that are known to gcc. More...
 
unsigned IsSupportedByPragmaAttribute: 1
 True if this attribute is supported by #pragma clang attribute. More...
 
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 44 of file ParsedAttr.h.

Member Enumeration Documentation

◆ AttrHandling

Enumerator
NotHandled 
AttributeApplied 
AttributeNotApplied 

Definition at line 138 of file ParsedAttr.h.

Constructor & Destructor Documentation

◆ ParsedAttrInfo() [1/2]

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

Definition at line 77 of file ParsedAttr.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 83 of file ParsedAttr.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 118 of file ParsedAttr.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 102 of file ParsedAttr.h.

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

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

◆ 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 121 of file ParsedAttr.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 148 of file ParsedAttr.cpp.

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

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

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

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

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

References UINT_MAX.

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

Member Data Documentation

◆ AcceptsExprPack

unsigned clang::ParsedAttrInfo::AcceptsExprPack

Definition at line 56 of file ParsedAttr.h.

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

◆ ArgNames

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

Definition at line 74 of file ParsedAttr.h.

◆ AttrKind

unsigned clang::ParsedAttrInfo::AttrKind

Corresponds to the Kind enum.

Definition at line 46 of file ParsedAttr.h.

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

◆ HasCustomParsing

unsigned clang::ParsedAttrInfo::HasCustomParsing

True if the parsing does not match the semantic content.

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

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

◆ IsStmt

unsigned clang::ParsedAttrInfo::IsStmt

True if this attribute applies to statements.

Definition at line 62 of file ParsedAttr.h.

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

◆ IsSupportedByPragmaAttribute

unsigned clang::ParsedAttrInfo::IsSupportedByPragmaAttribute

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

Definition at line 66 of file ParsedAttr.h.

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

◆ IsTargetSpecific

unsigned clang::ParsedAttrInfo::IsTargetSpecific

True if this attribute is only available for certain targets.

Definition at line 58 of file ParsedAttr.h.

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

◆ IsType

unsigned clang::ParsedAttrInfo::IsType

True if this attribute applies to types.

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

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

◆ NumArgs

unsigned clang::ParsedAttrInfo::NumArgs

The number of required arguments of this attribute.

Definition at line 48 of file ParsedAttr.h.

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

◆ OptArgs

unsigned clang::ParsedAttrInfo::OptArgs

The number of optional arguments of this attributes.

Definition at line 50 of file ParsedAttr.h.

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

◆ Spellings

ArrayRef<Spelling> clang::ParsedAttrInfo::Spellings

Definition at line 72 of file ParsedAttr.h.


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