clang 19.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_HLSLSemantic , 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_HLSLSemantic 

<vardecl> : <semantic>

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::Sema::AddParameterABIAttr(), attrNonNullArgCheck(), clang::Sema::BuildCodeAlignAttr(), checkAcquireOrderAttrCommon(), checkAMDGPUMaxNumWorkGroupsArguments(), checkArmNewAttrMutualExclusion(), checkAttrArgsAreCapabilityObjs(), checkAttributeNumArgsImpl(), checkAttrMutualExclusion(), clang::Sema::CheckAttrTarget(), clang::Sema::CheckCallingConvAttr(), checkForConsumableClass(), checkFunctionConditionAttr(), checkIBOutletCommon(), checkMutualExclusion(), CheckNullabilityTypeSpecifier(), clang::Sema::CheckRegparmAttr(), checkTryLockFunAttrCommon(), clang::Sema::DiagnoseHLSLAttrStageMismatch(), clang::ParsedAttr::diagnoseLangOpts(), getAttrLoc(), handleAbiTagAttr(), handleAcquireHandleAttr(), HandleAddressSpaceTypeAttribute(), handleAliasAttr(), handleAlignedAttr(), handleAllocSizeAttr(), handleAnalyzerNoReturnAttr(), HandleAnnotateTypeAttr(), handleAnyX86InterruptAttr(), handleArgumentWithTypeTagAttr(), handleArmBuiltinAliasAttr(), handleARMInterruptAttr(), HandleArmMveStrictPolymorphismAttr(), handleArmNewAttr(), handleArmStateAttribute(), HandleArmSveVectorBitsTypeAttr(), handleAvailabilityAttr(), handleBlocksAttr(), HandleBTFTypeTagAttribute(), handleBuiltinAliasAttr(), handleCallbackAttr(), handleCallConvAttr(), handleCalledOnceAttr(), handleCFGuardAttr(), handleCmseNSEntryAttr(), handleCodeSegAttr(), handleCommonAttr(), handleConstantAttr(), handleConstructorAttr(), handleConsumableAttr(), handleCountedByAttr(), handleCPUSpecificAttr(), handleDeclspecThreadAttr(), handleDependencyAttr(), handleDeprecatedAttr(), handleDeviceAttr(), handleDiagnoseAsBuiltinAttr(), handleDiagnoseIfAttr(), handleEnableIfAttr(), handleEnforceTCBAttr(), handleEnumExtensibilityAttr(), HandleExtVectorTypeAttr(), handleFallThroughAttr(), handleFormatArgAttr(), handleFormatAttr(), handleGNUInlineAttr(), handleHLSLNumThreadsAttr(), handleHLSLResourceBindingAttr(), handleHLSLShaderAttr(), handleHLSLSV_DispatchThreadIDAttr(), handleIBOutletCollection(), handleIFuncAttr(), handleInitPriorityAttr(), handleLayoutVersion(), handleLifetimeCategoryAttr(), handleLikely(), handleM68kInterruptAttr(), handleManagedAttr(), HandleMatrixTypeAttr(), handleMinVectorWidthAttr(), handleMipsInterruptAttr(), handleModeAttr(), handleMSAllocatorAttr(), handleMSConstexprAttr(), handleMSInheritanceAttr(), handleMSP430InterruptAttr(), handleMSPointerTypeQualifierAttr(), handleNakedAttr(), HandleNeonVectorTypeAttr(), handleNoCfCheckAttr(), handleNoEscapeAttr(), handleNoMergeAttr(), handleNonNullAttr(), handleNonNullAttrParameter(), handleNoReturnAttr(), handleNSErrorDomain(), handleObjCBridgeAttr(), handleObjCDirectAttr(), handleObjCDirectMembersAttr(), handleObjCMethodFamilyAttr(), handleObjCPreciseLifetimeAttr(), handleObjCReturnsInnerPointerAttr(), handleObjCSuppresProtocolAttr(), HandleOpenCLAccessAttr(), handleOpenCLAccessAttr(), handleOpenCLNoSVMAttr(), handleOpenCLUnrollHint(), handleOwnershipAttr(), handlePackedAttr(), handleParamTypestateAttr(), handlePreferredName(), handlePreferredTypeAttr(), handleRestrictAttr(), handleReturnTypestateAttr(), handleRISCVInterruptAttr(), HandleRISCVRVVVectorBitsTypeAttr(), handleSentinelAttr(), handleSetTypestateAttr(), handleSharedAttr(), handleStandardNoReturnAttr(), handleSubGroupSize(), handleSuppressAttr(), handleSwiftAsyncAttr(), handleSwiftAsyncError(), handleSwiftBridge(), handleSwiftError(), handleSwiftNewType(), handleTargetClonesAttr(), handleTestTypestateAttr(), handleTransparentUnionAttr(), handleTypeTagForDatatypeAttr(), handleUnlikely(), handleUnusedAttr(), handleUuidAttr(), handleVecReturnAttr(), HandleVectorSizeAttr(), handleVecTypeHint(), handleVisibilityAttr(), handleWarnUnusedResult(), handleWeakImportAttr(), handleWeakRefAttr(), HandleWebAssemblyFuncrefAttr(), handleWebAssemblyImportModuleAttr(), handleWebAssemblyImportNameAttr(), handleWorkGroupSize(), handleX86ForceAlignArgPointerAttr(), instantiateDependentAnnotationAttr(), clang::Sema::mergeAlwaysInlineAttr(), clang::Sema::mergeAvailabilityAttr(), clang::Sema::mergeCodeSegAttr(), clang::Sema::mergeDLLImportAttr(), clang::Sema::mergeErrorAttr(), clang::Sema::mergeHLSLNumThreadsAttr(), clang::Sema::mergeHLSLParamModifierAttr(), clang::Sema::mergeHLSLShaderAttr(), clang::Sema::mergeInternalLinkageAttr(), clang::Sema::mergeMinSizeAttr(), clang::Sema::mergeMSInheritanceAttr(), clang::Sema::mergeOptimizeNoneAttr(), clang::Sema::mergeSectionAttr(), 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

Definition at line 204 of file AttributeCommonInfo.h.

References getParsedKind(), and isKeywordAttribute().

◆ 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().

◆ 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 canPrintOnLeftSide(), 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: