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

Inherited from DeclContext:

Inherited from TypeDecl:

Inherited from NamedDecl:

Inherited from Decl:

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)

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)

Declared at: clang/include/clang/AST/Decl.h:3638

Parameters

const clang::DeclContext* DC

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)

Declared at: clang/include/clang/AST/Decl.h:3631

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/Decl.h:3632

Parameters

clang::Decl::Kind K

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

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

Declared at: clang/include/clang/AST/Decl.h:3447

const clang::TagDecl* getCanonicalDecl() const

Declared at: clang/include/clang/AST/Decl.h:3460

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

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

Declared at: clang/include/clang/AST/Decl.h:3393

const clang::TagDecl::ExtInfo* getExtInfo() const

Declared at: clang/include/clang/AST/Decl.h:3394

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

Declared at: clang/include/clang/AST/Decl.h:3559

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

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

Declared at: clang/include/clang/AST/Decl.h:3618

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

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

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

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

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/Decl.h:3457

clang::TagDecl::TagKind getTagKind() const

Declared at: clang/include/clang/AST/Decl.h:3563

clang::TemplateParameterList*
getTemplateParameterList(unsigned int i) const

Declared at: clang/include/clang/AST/Decl.h:3622

Parameters

unsigned int i

clang::TypedefNameDecl*
getTypedefNameForAnonDecl() const

Declared at: clang/include/clang/AST/Decl.h:3594

bool hasExtInfo() const

Declared at: clang/include/clang/AST/Decl.h:3392

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

Description

Return true if this decl is currently being defined.

Declared at: clang/include/clang/AST/Decl.h:3491

bool isClass() const

Declared at: clang/include/clang/AST/Decl.h:3571

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

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

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

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

Declared at: clang/include/clang/AST/Decl.h:3573

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

Declared at: clang/include/clang/AST/Decl.h:3570

bool isStruct() const

Declared at: clang/include/clang/AST/Decl.h:3569

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

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

Declared at: clang/include/clang/AST/Decl.h:3572

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)

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)

Declared at: clang/include/clang/AST/Decl.h:3448

Parameters

clang::SourceRange R

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)

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)

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)

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)

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)

Declared at: clang/include/clang/AST/Decl.h:3616

Parameters

clang::NestedNameSpecifierLoc QualifierLoc

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)

Declared at: clang/include/clang/AST/Decl.h:3627

Parameters

clang::ASTContext& Context
ArrayRef<clang::TemplateParameterList*> TPLists

void setTypedefNameForAnonDecl(
    clang::TypedefNameDecl* TDD)

Declared at: clang/include/clang/AST/Decl.h:3599

Parameters

clang::TypedefNameDecl* TDD

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