clang 20.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes | Friends | List of all members
clang::AttributeCommonInfo Class Reference

#include "clang/Basic/AttributeCommonInfo.h"

Inheritance diagram for clang::AttributeCommonInfo:
Inheritance graph
[legend]

Classes

class  Form
 Combines information about the source-code form of an attribute, including its syntax and spelling. More...
 

Public Types

enum  Syntax {
  AS_GNU = 1 , AS_CXX11 , AS_C23 , AS_Declspec ,
  AS_Microsoft , AS_Keyword , AS_Pragma , AS_ContextSensitiveKeyword ,
  AS_HLSLAnnotation , AS_Implicit
}
 The style used to specify an attribute. More...
 
enum  Kind { NoSemaHandlerAttribute , IgnoredAttribute , UnknownAttribute }
 

Public Member Functions

 AttributeCommonInfo (const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Kind AttrKind, Form FormUsed)
 
 AttributeCommonInfo (const IdentifierInfo *AttrName, const IdentifierInfo *ScopeName, SourceRange AttrRange, SourceLocation ScopeLoc, Form FormUsed)
 
 AttributeCommonInfo (const IdentifierInfo *AttrName, SourceRange AttrRange, Form FormUsed)
 
 AttributeCommonInfo (SourceRange AttrRange, Kind K, Form FormUsed)
 
 AttributeCommonInfo (AttributeCommonInfo &&)=default
 
 AttributeCommonInfo (const AttributeCommonInfo &)=default
 
Kind getParsedKind () const
 
Syntax getSyntax () const
 
Form getForm () const
 
const IdentifierInfogetAttrName () const
 
void setAttrName (const IdentifierInfo *AttrNameII)
 
SourceLocation getLoc () const
 
SourceRange getRange () const
 
void setRange (SourceRange R)
 
bool hasScope () const
 
const IdentifierInfogetScopeName () const
 
SourceLocation getScopeLoc () const
 
std::string getNormalizedFullName () const
 Gets the normalized full name, which consists of both scope and name and with surrounding underscores removed as appropriate (e.g.
 
bool isDeclspecAttribute () const
 
bool isMicrosoftAttribute () const
 
bool isGNUScope () const
 
bool isClangScope () const
 
bool isCXX11Attribute () const
 
bool isC23Attribute () const
 
bool isAlignas () const
 
bool isStandardAttributeSyntax () const
 The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a keyword, like alignas.
 
bool isGNUAttribute () const
 
bool isKeywordAttribute () const
 
bool isRegularKeywordAttribute () const
 
bool isContextSensitiveKeywordAttribute () const
 
unsigned getAttributeSpellingListIndex () const
 
void setAttributeSpellingListIndex (unsigned V)
 

Static Public Member Functions

static Kind getParsedKind (const IdentifierInfo *Name, const IdentifierInfo *Scope, Syntax SyntaxUsed)
 

Protected Member Functions

bool isAttributeSpellingListCalculated () const
 

Static Protected Attributes

static constexpr unsigned SpellingNotCalculated = 0xf
 

Friends

class clang::ASTRecordWriter
 

Detailed Description

Definition at line 25 of file AttributeCommonInfo.h.

Member Enumeration Documentation

◆ Kind

Enumerator
NoSemaHandlerAttribute 
IgnoredAttribute 
UnknownAttribute 

Definition at line 62 of file AttributeCommonInfo.h.

◆ Syntax

The style used to specify an attribute.

Enumerator
AS_GNU 

attribute((...))

AS_CXX11 

[[...]]

AS_C23 

[[...]]

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.

AS_HLSLAnnotation 

<vardecl> : <annotation>

AS_Implicit 

The attibute has no source code manifestation and is only created implicitly.

Definition at line 28 of file AttributeCommonInfo.h.

Constructor & Destructor Documentation

◆ AttributeCommonInfo() [1/6]

clang::AttributeCommonInfo::AttributeCommonInfo ( const IdentifierInfo AttrName,
const IdentifierInfo ScopeName,
SourceRange  AttrRange,
SourceLocation  ScopeLoc,
Kind  AttrKind,
Form  FormUsed 
)
inline

Definition at line 140 of file AttributeCommonInfo.h.

References AS_GNU, and AS_Implicit.

◆ AttributeCommonInfo() [2/6]

clang::AttributeCommonInfo::AttributeCommonInfo ( const IdentifierInfo AttrName,
const IdentifierInfo ScopeName,
SourceRange  AttrRange,
SourceLocation  ScopeLoc,
Form  FormUsed 
)
inline

Definition at line 153 of file AttributeCommonInfo.h.

◆ AttributeCommonInfo() [3/6]

clang::AttributeCommonInfo::AttributeCommonInfo ( const IdentifierInfo AttrName,
SourceRange  AttrRange,
Form  FormUsed 
)
inline

Definition at line 161 of file AttributeCommonInfo.h.

◆ AttributeCommonInfo() [4/6]

clang::AttributeCommonInfo::AttributeCommonInfo ( SourceRange  AttrRange,
Kind  K,
Form  FormUsed 
)
inline

Definition at line 166 of file AttributeCommonInfo.h.

◆ AttributeCommonInfo() [5/6]

clang::AttributeCommonInfo::AttributeCommonInfo ( AttributeCommonInfo &&  )
default

◆ AttributeCommonInfo() [6/6]

clang::AttributeCommonInfo::AttributeCommonInfo ( const AttributeCommonInfo )
default

Member Function Documentation

◆ getAttributeSpellingListIndex()

unsigned clang::AttributeCommonInfo::getAttributeSpellingListIndex ( ) const
inline

◆ getAttrName()

const IdentifierInfo * clang::AttributeCommonInfo::getAttrName ( ) const
inline

◆ getForm()

Form clang::AttributeCommonInfo::getForm ( ) const
inline

Definition at line 175 of file AttributeCommonInfo.h.

References getSyntax().

◆ getLoc()

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

Definition at line 181 of file AttributeCommonInfo.h.

References clang::SourceRange::getBegin().

Referenced by clang::Sema::ActOnCXXAssumeAttr(), clang::Sema::AddAlignedAttr(), clang::Sema::AddAlignValueAttr(), clang::Sema::AddAllocAlignAttr(), clang::Sema::AddAssumeAlignedAttr(), clang::Sema::AddModeAttr(), clang::SemaSwift::AddParameterABIAttr(), attrNonNullArgCheck(), clang::Sema::BuildCodeAlignAttr(), checkAcquireOrderAttrCommon(), clang::checkAMDGPUMaxNumWorkGroupsArguments(), checkAttrArgsAreCapabilityObjs(), checkAttributeNumArgsImpl(), clang::checkAttrMutualExclusion(), clang::Sema::CheckAttrTarget(), clang::Sema::CheckCallingConvAttr(), checkForConsumableClass(), checkFunctionConditionAttr(), clang::checkIBOutletCommon(), checkMutualExclusion(), clang::checkNewAttrMutualExclusion(), CheckNullabilityTypeSpecifier(), clang::Sema::CheckRegparmAttr(), checkTryLockFunAttrCommon(), clang::SemaHLSL::DiagnoseAttrStageMismatch(), clang::ParsedAttr::diagnoseLangOpts(), clang::Sema::getAttrLoc(), getPosAsWritten(), handleAbiTagAttr(), clang::SemaOpenCL::handleAccessAttr(), handleAcquireHandleAttr(), HandleAddressSpaceTypeAttribute(), handleAliasAttr(), handleAlignedAttr(), handleAllocSizeAttr(), handleAnalyzerNoReturnAttr(), HandleAnnotateTypeAttr(), clang::SemaX86::handleAnyInterruptAttr(), handleArgumentWithTypeTagAttr(), HandleArmMveStrictPolymorphismAttr(), handleArmStateAttribute(), HandleArmSveVectorBitsTypeAttr(), clang::SemaSwift::handleAsyncAttr(), clang::SemaSwift::handleAsyncError(), handleAvailabilityAttr(), clang::SemaObjC::handleBlocksAttr(), clang::SemaSwift::handleBridge(), clang::SemaObjC::handleBridgeAttr(), HandleBTFTypeTagAttribute(), clang::SemaARM::handleBuiltinAliasAttr(), handleBuiltinAliasAttr(), handleCallbackAttr(), handleCallConvAttr(), handleCalledOnceAttr(), handleCFGuardAttr(), clang::SemaARM::handleCmseNSEntryAttr(), handleCodeSegAttr(), handleCommonAttr(), handleConstantAttr(), handleConstructorAttr(), handleConsumableAttr(), handleCPUSpecificAttr(), handleDeclspecThreadAttr(), handleDependencyAttr(), handleDeprecatedAttr(), handleDeviceAttr(), handleDiagnoseAsBuiltinAttr(), handleDiagnoseIfAttr(), clang::SemaObjC::handleDirectAttr(), clang::SemaObjC::handleDirectMembersAttr(), handleEnableIfAttr(), handleEnforceTCBAttr(), handleEnumExtensibilityAttr(), clang::SemaSwift::handleError(), handleExcludeFromExplicitInstantiationAttr(), HandleExtVectorTypeAttr(), handleFallThroughAttr(), clang::SemaX86::handleForceAlignArgPointerAttr(), handleFormatArgAttr(), handleFormatAttr(), handleGNUInlineAttr(), clang::SemaObjC::handleIBOutletCollection(), handleIFuncAttr(), handleInitPriorityAttr(), clang::SemaARM::handleInterruptAttr(), clang::SemaM68k::handleInterruptAttr(), clang::SemaMIPS::handleInterruptAttr(), clang::SemaMSP430::handleInterruptAttr(), clang::SemaRISCV::handleInterruptAttr(), handleLayoutVersion(), handleLifetimeCategoryAttr(), handleLikely(), handleManagedAttr(), HandleMatrixTypeAttr(), clang::SemaObjC::handleMethodFamilyAttr(), handleMinVectorWidthAttr(), handleModeAttr(), handleMSAllocatorAttr(), handleMSConstexprAttr(), handleMSInheritanceAttr(), handleMSPointerTypeQualifierAttr(), handleNakedAttr(), HandleNeonVectorTypeAttr(), clang::SemaARM::handleNewAttr(), clang::SemaSwift::handleNewType(), handleNoCfCheckAttr(), handleNoEscapeAttr(), handleNoMergeAttr(), handleNonBlockingNonAllocatingTypeAttr(), handleNonNullAttr(), handleNonNullAttrParameter(), handleNoReturnAttr(), clang::SemaOpenCL::handleNoSVMAttr(), clang::SemaObjC::handleNSErrorDomain(), clang::SemaHLSL::handleNumThreadsAttr(), HandleOpenCLAccessAttr(), handleOpenCLUnrollHint(), handleOwnershipAttr(), handlePackedAttr(), clang::SemaHLSL::handlePackOffsetAttr(), handleParamTypestateAttr(), handlePatchableFunctionEntryAttr(), clang::SemaObjC::handlePreciseLifetimeAttr(), handlePreferredName(), handlePreferredTypeAttr(), clang::SemaHLSL::handleResourceBindingAttr(), clang::SemaHLSL::handleResourceClassAttr(), handleRestrictAttr(), clang::SemaObjC::handleReturnsInnerPointerAttr(), handleReturnTypestateAttr(), HandleRISCVRVVVectorBitsTypeAttr(), handleSentinelAttr(), handleSetTypestateAttr(), clang::SemaHLSL::handleShaderAttr(), handleSharedAttr(), handleStandardNoReturnAttr(), clang::SemaOpenCL::handleSubGroupSize(), clang::SemaObjC::handleSuppresProtocolAttr(), handleSuppressAttr(), clang::SemaHLSL::handleSV_DispatchThreadIDAttr(), handleTargetClonesAttr(), handleTestTypestateAttr(), handleTransparentUnionAttr(), handleTypeTagForDatatypeAttr(), handleUnlikely(), handleUnusedAttr(), handleUuidAttr(), handleVecReturnAttr(), HandleVectorSizeAttr(), handleVecTypeHint(), handleVisibilityAttr(), handleVTablePointerAuthentication(), handleWarnUnusedResult(), handleWeakImportAttr(), handleWeakRefAttr(), HandleWebAssemblyFuncrefAttr(), clang::SemaWasm::handleWebAssemblyImportModuleAttr(), clang::SemaWasm::handleWebAssemblyImportNameAttr(), handleWorkGroupSize(), instantiateDependentAnnotationAttr(), markUsedForAliasOrIfunc(), clang::Sema::mergeAlwaysInlineAttr(), clang::Sema::mergeAvailabilityAttr(), clang::Sema::mergeCodeSegAttr(), clang::Sema::mergeDLLImportAttr(), clang::Sema::mergeErrorAttr(), clang::Sema::mergeInternalLinkageAttr(), clang::Sema::mergeMinSizeAttr(), clang::Sema::mergeMSInheritanceAttr(), clang::SemaHLSL::mergeNumThreadsAttr(), clang::Sema::mergeOptimizeNoneAttr(), clang::SemaHLSL::mergeParamModifierAttr(), clang::Sema::mergeSectionAttr(), clang::SemaHLSL::mergeShaderAttr(), clang::Sema::mergeUuidAttr(), mergeVisibilityAttr(), ProcessDeclAttribute(), ProcessStmtAttribute(), threadSafetyCheckIsPointer(), and verifyValidIntegerConstantExpr().

◆ getNormalizedFullName()

std::string AttributeCommonInfo::getNormalizedFullName ( ) const

Gets the normalized full name, which consists of both scope and name and with surrounding underscores removed as appropriate (e.g.

gnu::attr will be normalized to gnu::attr).

Definition at line 151 of file Attributes.cpp.

References getAttrName(), getScopeName(), getSyntax(), and normalizeName().

Referenced by clang::ParsedAttrInfo::get(), and clang::Sema::mergeErrorAttr().

◆ getParsedKind() [1/2]

Kind clang::AttributeCommonInfo::getParsedKind ( ) const
inline

◆ getParsedKind() [2/2]

AttributeCommonInfo::Kind AttributeCommonInfo::getParsedKind ( const IdentifierInfo Name,
const IdentifierInfo Scope,
Syntax  SyntaxUsed 
)
static

Definition at line 145 of file Attributes.cpp.

References normalizeName().

◆ getRange()

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

◆ getScopeLoc()

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

Definition at line 187 of file AttributeCommonInfo.h.

Referenced by clang::ASTRecordWriter::AddAttr().

◆ getScopeName()

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

◆ getSyntax()

Syntax clang::AttributeCommonInfo::getSyntax ( ) const
inline

◆ hasScope()

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

Definition at line 185 of file AttributeCommonInfo.h.

◆ isAlignas()

bool clang::AttributeCommonInfo::isAlignas ( ) const
inline

◆ isAttributeSpellingListCalculated()

bool clang::AttributeCommonInfo::isAttributeSpellingListCalculated ( ) const
inlineprotected

Definition at line 254 of file AttributeCommonInfo.h.

References SpellingNotCalculated.

Referenced by getAttributeSpellingListIndex().

◆ isC23Attribute()

bool clang::AttributeCommonInfo::isC23Attribute ( ) const
inline

Definition at line 202 of file AttributeCommonInfo.h.

References AS_C23.

Referenced by isStandardAttributeSyntax(), and ProcessDeclAttribute().

◆ isClangScope()

bool AttributeCommonInfo::isClangScope ( ) const

Definition at line 121 of file Attributes.cpp.

References clang::IdentifierInfo::isStr().

Referenced by handleWarnUnusedResult(), and ProcessDeclAttribute().

◆ isContextSensitiveKeywordAttribute()

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

Definition at line 227 of file AttributeCommonInfo.h.

References AS_ContextSensitiveKeyword.

Referenced by CheckNullabilityTypeSpecifier().

◆ isCXX11Attribute()

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

◆ isDeclspecAttribute()

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

◆ isGNUAttribute()

bool clang::AttributeCommonInfo::isGNUAttribute ( ) const
inline

Definition at line 219 of file AttributeCommonInfo.h.

References AS_GNU.

Referenced by handleWarnUnusedResult().

◆ isGNUScope()

bool AttributeCommonInfo::isGNUScope ( ) const

Definition at line 117 of file Attributes.cpp.

References clang::IdentifierInfo::isStr().

Referenced by handleDeprecatedAttr(), and handleWarnUnusedResult().

◆ isKeywordAttribute()

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

Definition at line 221 of file AttributeCommonInfo.h.

References AS_ContextSensitiveKeyword, and AS_Keyword.

Referenced by isAlignas().

◆ isMicrosoftAttribute()

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

Definition at line 195 of file AttributeCommonInfo.h.

References AS_Microsoft.

Referenced by handleUuidAttr().

◆ isRegularKeywordAttribute()

bool clang::AttributeCommonInfo::isRegularKeywordAttribute ( ) const
inline

◆ isStandardAttributeSyntax()

bool clang::AttributeCommonInfo::isStandardAttributeSyntax ( ) const
inline

The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a keyword, like alignas.

Definition at line 215 of file AttributeCommonInfo.h.

References isC23Attribute(), and isCXX11Attribute().

Referenced by clang::Declarator::Declarator(), handleAnalyzerNoReturnAttr(), handleDeprecatedAttr(), handleNoSanitizeSpecificAttr(), handleWarnUnusedResult(), ProcessDeclAttribute(), and clang::ParsedAttr::slidesFromDeclToDeclSpecLegacyBehavior().

◆ setAttributeSpellingListIndex()

void clang::AttributeCommonInfo::setAttributeSpellingListIndex ( unsigned  V)
inline

Definition at line 238 of file AttributeCommonInfo.h.

References V.

Referenced by handleNoSanitizeSpecificAttr().

◆ setAttrName()

void clang::AttributeCommonInfo::setAttrName ( const IdentifierInfo AttrNameII)
inline

Definition at line 180 of file AttributeCommonInfo.h.

◆ setRange()

void clang::AttributeCommonInfo::setRange ( SourceRange  R)
inline

Definition at line 183 of file AttributeCommonInfo.h.

Friends And Related Function Documentation

◆ clang::ASTRecordWriter

friend class clang::ASTRecordWriter
friend

Definition at line 249 of file AttributeCommonInfo.h.

Member Data Documentation

◆ SpellingNotCalculated

constexpr unsigned clang::AttributeCommonInfo::SpellingNotCalculated = 0xf
staticconstexprprotected

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