class TagDecl
Declaration
class TagDecl : public TypeDecl,
public DeclContext,
public Redeclarable { /* full declaration omitted */ };
Description
Represents the declaration of a struct/union/class/enum.
Declared at: clang/include/clang/AST/Decl.h:3366
Inherits from: TypeDecl, DeclContext, Redeclarable
Member Variables
- private clang::SourceRange BraceRange
- private llvm::PointerUnion<TypedefNameDecl*, ExtInfo*> TypedefNameDeclOrQualifier
- If the (out-of-line) tag declaration name is qualified, it points to the qualifier info (nns and range); otherwise, if the tag declaration is anonymous and it is part of a typedef or alias, it points to the TypedefNameDecl (used for mangling); otherwise, if the tag declaration is anonymous and it is used as a declaration specifier for variables, it points to the first VarDecl (used for mangling); otherwise, it is a null (TypedefNameDecl) pointer.
Inherited from DeclContext:
- protected
- protected FirstDecl = nullptr
- protected LastDecl = nullptr
Inherited from Decl:
- protected NextInContextAndBits
- protected Access
- protected FromASTFile
- protected IdentifierNamespace
- protected CacheValidAndLinkage
Method Overview
- protected TagDecl(clang::Decl::Kind DK, clang::TagDecl::TagKind TK, const clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation L, clang::IdentifierInfo * Id, clang::TagDecl * PrevDecl, clang::SourceLocation StartL)
- public static clang::TagDecl * castFromDeclContext(const clang::DeclContext * DC)
- public static clang::DeclContext * castToDeclContext(const clang::TagDecl * D)
- public static bool classof(const clang::Decl * D)
- public static bool classofKind(clang::Decl::Kind K)
- protected void completeDefinition()
- public void demoteThisDefinitionToDeclaration()
- public clang::SourceRange getBraceRange() const
- public const clang::TagDecl * getCanonicalDecl() const
- public clang::TagDecl * getCanonicalDecl()
- public clang::TagDecl * getDefinition() const
- private clang::TagDecl::ExtInfo * getExtInfo()
- private const clang::TagDecl::ExtInfo * getExtInfo() const
- public clang::SourceLocation getInnerLocStart() const
- public llvm::StringRef getKindName() const
- protected clang::TagDecl * getMostRecentDeclImpl()
- protected clang::TagDecl * getNextRedeclarationImpl()
- public unsigned int getNumTemplateParameterLists() const
- public clang::SourceLocation getOuterLocStart() const
- protected clang::TagDecl * getPreviousDeclImpl()
- public clang::NestedNameSpecifier * getQualifier() const
- public clang::NestedNameSpecifierLoc getQualifierLoc() const
- public clang::SourceRange getSourceRange() const
- public clang::TagDecl::TagKind getTagKind() const
- public clang::TemplateParameterList * getTemplateParameterList(unsigned int i) const
- public clang::TypedefNameDecl * getTypedefNameForAnonDecl() const
- private bool hasExtInfo() const
- public bool hasNameForLinkage() const
- public bool isBeingDefined() const
- public bool isClass() const
- public bool isCompleteDefinition() const
- public bool isCompleteDefinitionRequired() const
- public bool isDependentType() const
- public bool isEmbeddedInDeclarator() const
- public bool isEnum() const
- public bool isFreeStanding() const
- public bool isInterface() const
- public bool isStruct() const
- public bool isThisDeclarationADefinition() const
- public bool isThisDeclarationADemotedDefinition() const
- public bool isUnion() const
- public bool mayHaveOutOfDateDef() const
- protected void setBeingDefined(bool V = true)
- public void setBraceRange(clang::SourceRange R)
- public void setCompleteDefinition(bool V = true)
- public void setCompleteDefinitionRequired(bool V = true)
- public void setEmbeddedInDeclarator(bool isInDeclarator)
- public void setFreeStanding(bool isFreeStanding = true)
- protected void setMayHaveOutOfDateDef(bool V = true)
- public void setQualifierInfo(clang::NestedNameSpecifierLoc QualifierLoc)
- public void setTagKind(clang::TagDecl::TagKind TK)
- public void setTemplateParameterListsInfo(clang::ASTContext & Context, ArrayRef<clang::TemplateParameterList *> TPLists)
- public void setTypedefNameForAnonDecl(clang::TypedefNameDecl * TDD)
- public void startDefinition()
Inherited from DeclContext:
- protected BuildDeclChain
- public Encloses
- public Equals
- public InEnclosingNamespaceSetOf
- public addDecl
- public addDeclInternal
- public addHiddenDecl
- public buildLookup
- public classof
- public classof
- public collectAllContexts
- public containsDecl
- public containsDeclAndLoad
- public ddiags
- public decls
- public decls_begin
- public decls_empty
- public decls_end
- public dumpDeclContext
- public dumpLookups
- public dumpLookups
- public getDeclKind
- public getDeclKindName
- public getEnclosingNamespaceContext
- public getEnclosingNamespaceContext
- public getExternCContext
- public getInnermostBlockDecl
- public getLexicalParent
- public getLexicalParent
- public getLookupParent
- public getLookupParent
- public getLookupPtr
- public getNonClosureAncestor
- public getNonClosureAncestor
- public getNonTransparentContext
- public getNonTransparentContext
- public getOuterLexicalRecordContext
- public getOuterLexicalRecordContext
- public getParent
- public getParent
- public getParentASTContext
- public getPrimaryContext
- public getPrimaryContext
- public getRedeclContext
- public getRedeclContext
- public hasExternalLexicalStorage
- public hasExternalVisibleStorage
- public isClosure
- public isDeclInLexicalTraversal
- public isDependentContext
- public isExternCContext
- public isExternCXXContext
- public isFileContext
- public isFunctionOrMethod
- public isInlineNamespace
- public isLookupContext
- public isNamespace
- public isObjCContainer
- public isRecord
- public isStdNamespace
- public isTranslationUnit
- public isTransparentContext
- public localUncachedLookup
- public lookup
- public lookups
- public lookups_begin
- public lookups_end
- public makeDeclVisibleInContext
- public noload_decls
- public noload_decls_begin
- public noload_decls_end
- public noload_lookup
- public noload_lookups
- public noload_lookups_begin
- public noload_lookups_end
- public removeDecl
- public setHasExternalLexicalStorage
- public setHasExternalVisibleStorage
- public setMustBuildLookupTable
- public setUseQualifiedLookup
- public shouldUseQualifiedLookup
- public using_directives
Inherited from TypeDecl:
- public classof
- public classofKind
- public getBeginLoc
- public getSourceRange
- public getTypeForDecl
- public setLocStart
- public setTypeForDecl
Inherited from NamedDecl:
- public classof
- public classofKind
- public declarationReplaces
- public getDeclName
- public getExplicitVisibility
- public getFormalLinkage
- public getIdentifier
- public getLinkageAndVisibility
- public getLinkageInternal
- public getMostRecentDecl
- public getMostRecentDecl
- public getName
- public getNameAsString
- public getNameForDiagnostic
- public getObjCFStringFormattingFamily
- public getQualifiedNameAsString
- public getUnderlyingDecl
- public getUnderlyingDecl
- public getVisibility
- public hasExternalFormalLinkage
- public hasLinkage
- public hasLinkageBeenComputed
- public isCXXClassMember
- public isCXXInstanceMember
- public isExternallyDeclarable
- public isExternallyVisible
- public isLinkageValid
- public isReserved
- public printName
- public printNestedNameSpecifier
- public printNestedNameSpecifier
- public printQualifiedName
- public printQualifiedName
- public setDeclName
Inherited from Decl:
- public EnableStatistics
- public PrintStats
- public add
- public addAttr
- public attr_begin
- public attr_end
- public attrs
- public canBeWeakImported
- public castFromDeclContext
- public castToDeclContext
- public classofKind
- public dropAttr
- public dropAttrs
- public dump
- public dump
- public dumpColor
- public getASTContext
- protected getASTMutationListener
- public getAccess
- public getAccessUnsafe
- public getAsFunction
- public getAsFunction
- public getAttr
- public getAttrs
- public getAttrs
- public getAvailability
- public getBeginLoc
- public getBody
- public getBodyRBrace
- protected getCachedLinkage
- public getCanonicalDecl
- public getCanonicalDecl
- public getDeclContext
- public getDeclContext
- public getDeclKindName
- public getDefiningAttr
- public getDescribedTemplate
- public getDescribedTemplateParams
- public getEndLoc
- public getExternalSourceSymbolAttr
- public getFriendObjectKind
- public getFunctionType
- public getGlobalID
- public getID
- public getIdentifierNamespace
- public getIdentifierNamespaceForKind
- public getImportedOwningModule
- public getKind
- public getLangOpts
- public getLexicalDeclContext
- public getLexicalDeclContext
- public getLocalOwningModule
- public getLocation
- public getMaxAlignment
- public getModuleOwnershipKind
- public getMostRecentDecl
- public getMostRecentDecl
- protected getMostRecentDeclImpl
- public getNextDeclInContext
- public getNextDeclInContext
- protected getNextRedeclarationImpl
- public getNonClosureContext
- public getNonClosureContext
- public getOwningModule
- public getOwningModuleForLinkage
- public getOwningModuleID
- public getParentFunctionOrMethod
- public getParentFunctionOrMethod
- public getPreviousDecl
- public getPreviousDecl
- protected getPreviousDeclImpl
- public getSourceRange
- public getTemplateDepth
- public getTranslationUnitDecl
- public getTranslationUnitDecl
- public getVersionIntroduced
- public hasAttr
- public hasAttrs
- public hasBody
- protected hasCachedLinkage
- public hasDefiningAttr
- protected hasLocalOwningModuleStorage
- public hasOwningModule
- public hasTagIdentifierNamespace
- public isCanonicalDecl
- public isDefinedOutsideFunctionOrMethod
- public isDeprecated
- public isDiscardedInGlobalModuleFragment
- public isFirstDecl
- public isFromASTFile
- public isFunctionOrFunctionTemplate
- public isImplicit
- public isInAnonymousNamespace
- public isInExportDeclContext
- public isInIdentifierNamespace
- public isInLocalScopeForInstantiation
- public isInStdNamespace
- public isInvalidDecl
- public isInvisibleOutsideTheOwningModule
- public isLocalExternDecl
- public isModulePrivate
- public isOutOfLine
- public isParameterPack
- public isReachable
- public isReferenced
- public isTagIdentifierNamespace
- public isTemplateDecl
- public isTemplateParameter
- public isTemplateParameterPack
- public isTemplated
- public isThisDeclarationReferenced
- public isTopLevelDeclInObjCContainer
- public isUnavailable
- public isUnconditionallyVisible
- public isUsed
- public isWeakImported
- public markUsed
- public print
- public print
- public printGroup
- public redecls
- public redecls_begin
- public redecls_end
- public setAccess
- public setAttrs
- protected setCachedLinkage
- public setDeclContext
- public setFromASTFile
- public setImplicit
- public setInvalidDecl
- public setIsUsed
- public setLexicalDeclContext
- public setLocalExternDecl
- public setLocalOwningModule
- public setLocation
- public setModuleOwnershipKind
- protected setModulePrivate
- public setNonMemberOperator
- public setObjectOfFriendDecl
- public setOwningModuleID
- public setReferenced
- public setTopLevelDeclInObjCContainer
- public setVisibleDespiteOwningModule
- public specific_attr_begin
- public specific_attr_end
- public specific_attrs
- protected updateOutOfDate
Methods
¶TagDecl(clang::Decl::Kind DK,
clang::TagDecl::TagKind TK,
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation L,
clang::IdentifierInfo* Id,
clang::TagDecl* PrevDecl,
clang::SourceLocation StartL)
TagDecl(clang::Decl::Kind DK,
clang::TagDecl::TagKind TK,
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation L,
clang::IdentifierInfo* Id,
clang::TagDecl* PrevDecl,
clang::SourceLocation StartL)
Declared at: clang/include/clang/AST/Decl.h:3399
Parameters
- clang::Decl::Kind DK
- clang::TagDecl::TagKind TK
- const clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation L
- clang::IdentifierInfo* Id
- clang::TagDecl* PrevDecl
- clang::SourceLocation StartL
¶static clang::TagDecl* castFromDeclContext(
const clang::DeclContext* DC)
static clang::TagDecl* castFromDeclContext(
const clang::DeclContext* DC)
Declared at: clang/include/clang/AST/Decl.h:3638
Parameters
- const clang::DeclContext* DC
¶static clang::DeclContext* castToDeclContext(
const clang::TagDecl* D)
static clang::DeclContext* castToDeclContext(
const clang::TagDecl* D)
Declared at: clang/include/clang/AST/Decl.h:3634
Parameters
- const clang::TagDecl* D
¶static bool classof(const clang::Decl* D)
static bool classof(const clang::Decl* D)
Declared at: clang/include/clang/AST/Decl.h:3631
Parameters
- const clang::Decl* D
¶static bool classofKind(clang::Decl::Kind K)
static bool classofKind(clang::Decl::Kind K)
Declared at: clang/include/clang/AST/Decl.h:3632
Parameters
- clang::Decl::Kind K
¶void completeDefinition()
void completeDefinition()
Description
Completes the definition of this tag declaration. This is a helper function for derived classes.
Declared at: clang/include/clang/AST/Decl.h:3420
¶void demoteThisDefinitionToDeclaration()
void demoteThisDefinitionToDeclaration()
Description
Mark a definition as a declaration and maintain information it _was_ a definition.
Declared at: clang/include/clang/AST/Decl.h:3535
¶clang::SourceRange getBraceRange() const
clang::SourceRange getBraceRange() const
Declared at: clang/include/clang/AST/Decl.h:3447
¶const clang::TagDecl* getCanonicalDecl() const
const clang::TagDecl* getCanonicalDecl() const
Declared at: clang/include/clang/AST/Decl.h:3460
¶clang::TagDecl* getCanonicalDecl()
clang::TagDecl* getCanonicalDecl()
Description
Retrieves the "canonical" declaration of the given declaration.
Declared at: clang/include/clang/AST/Decl.h:3459
¶clang::TagDecl* getDefinition() const
clang::TagDecl* getDefinition() const
Description
Returns the TagDecl that actually defines this struct/union/class/enum. When determining whether or not a struct/union/class/enum has a definition, one should use this method as opposed to 'isDefinition'. 'isDefinition' indicates whether or not a specific TagDecl is defining declaration, not whether or not the struct/union/class/enum type is defined. This method returns NULL if there is no TagDecl that defines the struct/union/class/enum.
Declared at: clang/include/clang/AST/Decl.h:3557
¶clang::TagDecl::ExtInfo* getExtInfo()
clang::TagDecl::ExtInfo* getExtInfo()
Declared at: clang/include/clang/AST/Decl.h:3393
¶const clang::TagDecl::ExtInfo* getExtInfo() const
const clang::TagDecl::ExtInfo* getExtInfo() const
Declared at: clang/include/clang/AST/Decl.h:3394
¶clang::SourceLocation getInnerLocStart() const
clang::SourceLocation getInnerLocStart() const
Description
Return SourceLocation representing start of source range ignoring outer template declarations.
Declared at: clang/include/clang/AST/Decl.h:3452
¶llvm::StringRef getKindName() const
llvm::StringRef getKindName() const
Declared at: clang/include/clang/AST/Decl.h:3559
¶clang::TagDecl* getMostRecentDeclImpl()
clang::TagDecl* getMostRecentDeclImpl()
Description
Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.
Declared at: clang/include/clang/AST/Decl.h:3413
¶clang::TagDecl* getNextRedeclarationImpl()
clang::TagDecl* getNextRedeclarationImpl()
Description
Returns the next redeclaration or itself if this is the only decl. Decl subclasses that can be redeclared should override this method so that Decl::redecl_iterator can iterate over them.
Declared at: clang/include/clang/AST/Decl.h:3405
¶unsigned int getNumTemplateParameterLists() const
unsigned int getNumTemplateParameterLists() const
Declared at: clang/include/clang/AST/Decl.h:3618
¶clang::SourceLocation getOuterLocStart() const
clang::SourceLocation getOuterLocStart() const
Description
Return SourceLocation representing start of source range taking into account any outer template declarations.
Declared at: clang/include/clang/AST/Decl.h:3456
¶clang::TagDecl* getPreviousDeclImpl()
clang::TagDecl* getPreviousDeclImpl()
Description
Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
Declared at: clang/include/clang/AST/Decl.h:3409
¶clang::NestedNameSpecifier* getQualifier() const
clang::NestedNameSpecifier* getQualifier() const
Description
Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in the source.
Declared at: clang/include/clang/AST/Decl.h:3603
¶clang::NestedNameSpecifierLoc getQualifierLoc()
const
clang::NestedNameSpecifierLoc getQualifierLoc()
const
Description
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this declaration, if it was present in the source.
Declared at: clang/include/clang/AST/Decl.h:3611
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Description
Source range that this declaration covers.
Declared at: clang/include/clang/AST/Decl.h:3457
¶clang::TagDecl::TagKind getTagKind() const
clang::TagDecl::TagKind getTagKind() const
Declared at: clang/include/clang/AST/Decl.h:3563
¶clang::TemplateParameterList*
getTemplateParameterList(unsigned int i) const
clang::TemplateParameterList*
getTemplateParameterList(unsigned int i) const
Declared at: clang/include/clang/AST/Decl.h:3622
Parameters
- unsigned int i
¶clang::TypedefNameDecl*
getTypedefNameForAnonDecl() const
clang::TypedefNameDecl*
getTypedefNameForAnonDecl() const
Declared at: clang/include/clang/AST/Decl.h:3594
¶bool hasExtInfo() const
bool hasExtInfo() const
Declared at: clang/include/clang/AST/Decl.h:3392
¶bool hasNameForLinkage() const
bool hasNameForLinkage() const
Description
Is this tag type named, either directly or via being defined in a typedef of this type? C++11 [basic.link]p8: A type is said to have linkage if and only if: - it is a class or enumeration type that is named (or has a name for linkage purposes) and the name has linkage; ... C++11 [dcl.typedef]p9: If the typedef declaration defines an unnamed class (or enum), the first typedef-name declared by the declaration to be that class type (or enum type) is used to denote the class type (or enum type) for linkage purposes only. C does not have an analogous rule, but the same concept is nonetheless useful in some places.
Declared at: clang/include/clang/AST/Decl.h:3590
¶bool isBeingDefined() const
bool isBeingDefined() const
Description
Return true if this decl is currently being defined.
Declared at: clang/include/clang/AST/Decl.h:3491
¶bool isClass() const
bool isClass() const
Declared at: clang/include/clang/AST/Decl.h:3571
¶bool isCompleteDefinition() const
bool isCompleteDefinition() const
Description
Return true if this decl has its body fully specified.
Declared at: clang/include/clang/AST/Decl.h:3471
¶bool isCompleteDefinitionRequired() const
bool isCompleteDefinitionRequired() const
Description
Return true if this complete decl is required to be complete for some existing use.
Declared at: clang/include/clang/AST/Decl.h:3480
¶bool isDependentType() const
bool isDependentType() const
Description
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on template parameters.
Declared at: clang/include/clang/AST/Decl.h:3522
¶bool isEmbeddedInDeclarator() const
bool isEmbeddedInDeclarator() const
Description
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the syntax of a declarator.
Declared at: clang/include/clang/AST/Decl.h:3495
¶bool isEnum() const
bool isEnum() const
Declared at: clang/include/clang/AST/Decl.h:3573
¶bool isFreeStanding() const
bool isFreeStanding() const
Description
True if this tag is free standing, e.g. "struct foo;".
Declared at: clang/include/clang/AST/Decl.h:3506
¶bool isInterface() const
bool isInterface() const
Declared at: clang/include/clang/AST/Decl.h:3570
¶bool isStruct() const
bool isStruct() const
Declared at: clang/include/clang/AST/Decl.h:3569
¶bool isThisDeclarationADefinition() const
bool isThisDeclarationADefinition() const
Description
Return true if this declaration is a completion definition of the type. Provided for consistency.
Declared at: clang/include/clang/AST/Decl.h:3466
¶bool isThisDeclarationADemotedDefinition() const
bool isThisDeclarationADemotedDefinition() const
Description
Whether this declaration was a definition in some module but was forced to be a declaration. Useful for clients checking if a module has a definition of a specific symbol and not interested in the final AST with deduplicated definitions.
Declared at: clang/include/clang/AST/Decl.h:3529
¶bool isUnion() const
bool isUnion() const
Declared at: clang/include/clang/AST/Decl.h:3572
¶bool mayHaveOutOfDateDef() const
bool mayHaveOutOfDateDef() const
Description
Indicates whether it is possible for declarations of this kind to have an out-of-date definition. This option is only enabled when modules are enabled.
Declared at: clang/include/clang/AST/Decl.h:3517
¶void setBeingDefined(bool V = true)
void setBeingDefined(bool V = true)
Description
True if this decl is currently being defined.
Declared at: clang/include/clang/AST/Decl.h:3423
Parameters
- bool V = true
¶void setBraceRange(clang::SourceRange R)
void setBraceRange(clang::SourceRange R)
Declared at: clang/include/clang/AST/Decl.h:3448
Parameters
¶void setCompleteDefinition(bool V = true)
void setCompleteDefinition(bool V = true)
Description
True if this decl has its body fully specified.
Declared at: clang/include/clang/AST/Decl.h:3474
Parameters
- bool V = true
¶void setCompleteDefinitionRequired(bool V = true)
void setCompleteDefinitionRequired(bool V = true)
Description
True if this complete decl is required to be complete for some existing use.
Declared at: clang/include/clang/AST/Decl.h:3486
Parameters
- bool V = true
¶void setEmbeddedInDeclarator(bool isInDeclarator)
void setEmbeddedInDeclarator(bool isInDeclarator)
Description
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the syntax of a declarator.
Declared at: clang/include/clang/AST/Decl.h:3501
Parameters
- bool isInDeclarator
¶void setFreeStanding(bool isFreeStanding = true)
void setFreeStanding(bool isFreeStanding = true)
Description
True if this tag is free standing, e.g. "struct foo;".
Declared at: clang/include/clang/AST/Decl.h:3509
Parameters
- bool isFreeStanding = true
¶void setMayHaveOutOfDateDef(bool V = true)
void setMayHaveOutOfDateDef(bool V = true)
Description
Indicates whether it is possible for declarations of this kind to have an out-of-date definition. This option is only enabled when modules are enabled.
Declared at: clang/include/clang/AST/Decl.h:3429
Parameters
- bool V = true
¶void setQualifierInfo(
clang::NestedNameSpecifierLoc QualifierLoc)
void setQualifierInfo(
clang::NestedNameSpecifierLoc QualifierLoc)
Declared at: clang/include/clang/AST/Decl.h:3616
Parameters
- clang::NestedNameSpecifierLoc QualifierLoc
¶void setTagKind(clang::TagDecl::TagKind TK)
void setTagKind(clang::TagDecl::TagKind TK)
Declared at: clang/include/clang/AST/Decl.h:3567
Parameters
- clang::TagDecl::TagKind TK
¶void setTemplateParameterListsInfo(
clang::ASTContext& Context,
ArrayRef<clang::TemplateParameterList*>
TPLists)
void setTemplateParameterListsInfo(
clang::ASTContext& Context,
ArrayRef<clang::TemplateParameterList*>
TPLists)
Declared at: clang/include/clang/AST/Decl.h:3627
Parameters
- clang::ASTContext& Context
- ArrayRef<clang::TemplateParameterList*> TPLists
¶void setTypedefNameForAnonDecl(
clang::TypedefNameDecl* TDD)
void setTypedefNameForAnonDecl(
clang::TypedefNameDecl* TDD)
Declared at: clang/include/clang/AST/Decl.h:3599
Parameters
¶void startDefinition()
void startDefinition()
Description
Starts the definition of this tag declaration. This method should be invoked at the beginning of the definition of this tag declaration. It will set the tag type into a state where it is in the process of being defined.
Declared at: clang/include/clang/AST/Decl.h:3547