clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
clang::TagDecl Class Reference

TagDecl - Represents the declaration of a struct/union/class/enum. More...

#include <Decl.h>

Inheritance diagram for clang::TagDecl:
Inheritance graph
[legend]
Collaboration diagram for clang::TagDecl:
Collaboration graph
[legend]

List of all members.

Public Types

typedef TagTypeKind TagKind
typedef
redeclarable_base::redecl_range 
redecl_range
typedef
redeclarable_base::redecl_iterator 
redecl_iterator

Public Member Functions

SourceLocation getRBraceLoc () const
void setRBraceLoc (SourceLocation L)
SourceLocation getInnerLocStart () const
SourceLocation getOuterLocStart () const
SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.
TagDeclgetCanonicalDecl () override
 Retrieves the "canonical" declaration of the given declaration.
const TagDeclgetCanonicalDecl () const
bool isThisDeclarationADefinition () const
bool isCompleteDefinition () const
bool isCompleteDefinitionRequired () const
 Return true if this complete decl is required to be complete for some existing use.
bool isBeingDefined () const
 isBeingDefined - Return true if this decl is currently being defined.
bool isEmbeddedInDeclarator () const
void setEmbeddedInDeclarator (bool isInDeclarator)
bool isFreeStanding () const
void setFreeStanding (bool isFreeStanding=true)
bool isDependentType () const
 Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on template parameters.
void startDefinition ()
 Starts the definition of this tag declaration.
TagDeclgetDefinition () const
void setCompleteDefinition (bool V)
void setCompleteDefinitionRequired (bool V=true)
StringRef getKindName () const
TagKind getTagKind () const
void setTagKind (TagKind TK)
bool isStruct () const
bool isInterface () const
bool isClass () const
bool isUnion () const
bool isEnum () const
bool hasNameForLinkage () const
bool hasDeclaratorForAnonDecl () const
DeclaratorDeclgetDeclaratorForAnonDecl () const
TypedefNameDeclgetTypedefNameForAnonDecl () const
void setDeclaratorForAnonDecl (DeclaratorDecl *DD)
void setTypedefNameForAnonDecl (TypedefNameDecl *TDD)
NestedNameSpecifiergetQualifier () const
 Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in the source.
NestedNameSpecifierLoc getQualifierLoc () const
 Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this declaration, if it was present in the source.
void setQualifierInfo (NestedNameSpecifierLoc QualifierLoc)
unsigned getNumTemplateParameterLists () const
TemplateParameterListgetTemplateParameterList (unsigned i) const
void setTemplateParameterListsInfo (ASTContext &Context, unsigned NumTPLists, TemplateParameterList **TPLists)

Static Public Member Functions

static bool classof (const Decl *D)
static bool classofKind (Kind K)
static DeclContextcastToDeclContext (const TagDecl *D)
static TagDeclcastFromDeclContext (const DeclContext *DC)

Protected Types

typedef Redeclarable< TagDeclredeclarable_base

Protected Member Functions

 TagDecl (Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, TagDecl *PrevDecl, SourceLocation StartL)
TagDeclgetNextRedeclarationImpl () override
 Returns the next redeclaration or itself if this is the only decl.
TagDeclgetPreviousDeclImpl () override
 Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.
TagDeclgetMostRecentDeclImpl () override
 Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.
void completeDefinition ()
 Completes the definition of this tag declaration.

Protected Attributes

bool IsBeingDefined: 1
 IsBeingDefined - True if this is currently being defined.
unsigned NumPositiveBits: 8
unsigned NumNegativeBits: 8
bool IsScoped: 1
bool IsScopedUsingClassTag: 1
bool IsFixed: 1
bool MayHaveOutOfDateDef: 1
 Indicates whether it is possible for declarations of this kind to have an out-of-date definition.
bool IsCompleteDefinitionRequired: 1

Friends

class ASTDeclReader
class ASTDeclWriter

Detailed Description

TagDecl - Represents the declaration of a struct/union/class/enum.

Definition at line 2590 of file Decl.h.


Member Typedef Documentation

typedef redeclarable_base::redecl_iterator clang::TagDecl::redecl_iterator

Definition at line 2701 of file Decl.h.

Reimplemented from clang::Redeclarable< TagDecl >.

Definition at line 2700 of file Decl.h.

Definition at line 2683 of file Decl.h.

Definition at line 2594 of file Decl.h.


Constructor & Destructor Documentation

clang::TagDecl::TagDecl ( Kind  DK,
TagKind  TK,
const ASTContext C,
DeclContext DC,
SourceLocation  L,
IdentifierInfo Id,
TagDecl PrevDecl,
SourceLocation  StartL 
) [inline, protected]

Definition at line 2670 of file Decl.h.

References clang::TTK_Enum.


Member Function Documentation

static TagDecl* clang::TagDecl::castFromDeclContext ( const DeclContext DC) [inline, static]

Reimplemented from clang::Decl.

Definition at line 2876 of file Decl.h.

Referenced by ValidDuplicateEnum().

static DeclContext* clang::TagDecl::castToDeclContext ( const TagDecl D) [inline, static]

Definition at line 2873 of file Decl.h.

static bool clang::TagDecl::classof ( const Decl D) [inline, static]
static bool clang::TagDecl::classofKind ( Kind  K) [inline, static]
void TagDecl::completeDefinition ( ) [protected]
TagDecl * TagDecl::getCanonicalDecl ( ) [override, virtual]

Retrieves the "canonical" declaration of the given declaration.

Reimplemented from clang::Decl.

Reimplemented in clang::EnumDecl, and clang::CXXRecordDecl.

Definition at line 3350 of file Decl.cpp.

References clang::Redeclarable< TagDecl >::getFirstDecl().

Referenced by clang::EnumDecl::getCanonicalDecl(), and clang::Sema::SetCtorInitializers().

const TagDecl* clang::TagDecl::getCanonicalDecl ( ) const [inline]

Reimplemented from clang::Decl.

Reimplemented in clang::EnumDecl, and clang::CXXRecordDecl.

Definition at line 2722 of file Decl.h.

getDefinition - 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.

Reimplemented in clang::RecordDecl, clang::EnumDecl, and clang::CXXRecordDecl.

Definition at line 3384 of file Decl.cpp.

References clang::NamedDecl::getIdentifier(), isCompleteDefinition(), MayHaveOutOfDateDef, clang::Redeclarable< TagDecl >::redecls(), and clang::Decl::updateOutOfDate().

Referenced by clang::Sema::ActOnTag(), clang::serialization::getDefinitiveDeclContext(), clang::DeclContext::getPrimaryContext(), and clang::Sema::isAcceptableTagRedeclaration().

getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template declarations.

Definition at line 2714 of file Decl.h.

Referenced by clang::Sema::InstantiateClass().

StringRef clang::TagDecl::getKindName ( ) const [inline]
TagDecl* clang::TagDecl::getMostRecentDeclImpl ( ) [inline, override, protected, virtual]

Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.

Reimplemented from clang::Decl.

Definition at line 2690 of file Decl.h.

TagDecl* clang::TagDecl::getNextRedeclarationImpl ( ) [inline, override, protected, virtual]

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.

Reimplemented from clang::Decl.

Definition at line 2684 of file Decl.h.

Definition at line 2859 of file Decl.h.

getOuterLocStart - Return SourceLocation representing start of source range taking into account any outer template declarations.

Definition at line 3341 of file Decl.cpp.

References getTemplateOrInnerLocStart().

Referenced by getSourceRange().

TagDecl* clang::TagDecl::getPreviousDeclImpl ( ) [inline, override, protected, virtual]

Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.

Reimplemented from clang::Decl.

Definition at line 2687 of file Decl.h.

Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in the source.

Definition at line 2844 of file Decl.h.

Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this declaration, if it was present in the source.

Definition at line 2852 of file Decl.h.

Referenced by clang::ASTNodeImporter::VisitClassTemplateDecl(), clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(), clang::ASTNodeImporter::VisitEnumDecl(), and clang::ASTNodeImporter::VisitRecordDecl().

SourceRange TagDecl::getSourceRange ( ) const [override, virtual]

Source range that this declaration covers.

Reimplemented from clang::TypeDecl.

Reimplemented in clang::ClassTemplateSpecializationDecl.

Definition at line 3345 of file Decl.cpp.

References clang::Decl::getLocation(), getOuterLocStart(), and clang::SourceLocation::isValid().

Referenced by assignInheritanceModel(), and clang::Sema::AttachBaseSpecifiers().

TagKind clang::TagDecl::getTagKind ( ) const [inline]

Definition at line 2862 of file Decl.h.

Definition at line 2824 of file Decl.h.

Referenced by clang::Sema::BuildVariableInstantiation().

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.

Definition at line 2820 of file Decl.h.

Referenced by clang::Sema::BuildVariableInstantiation(), computeCachedProperties(), findCommonEnumForBlockReturns(), and clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl().

bool clang::TagDecl::isClass ( ) const [inline]

Definition at line 2801 of file Decl.h.

References clang::TTK_Class.

Referenced by getAccessFlag(), clang::Type::isStructureOrClassType(), and isTBAAPathStruct().

Return true if this complete decl is required to be complete for some existing use.

Definition at line 2740 of file Decl.h.

Referenced by shouldOmitDefinition(), and clang::ASTDeclWriter::VisitTagDecl().

Definition at line 2749 of file Decl.h.

Referenced by clang::ASTDeclWriter::VisitTagDecl().

bool clang::TagDecl::isEnum ( ) const [inline]

Definition at line 2803 of file Decl.h.

References clang::TTK_Enum.

Referenced by clang::Sema::ActOnExplicitInstantiation().

Definition at line 2756 of file Decl.h.

Referenced by clang::ASTDeclWriter::VisitTagDecl().

bool clang::TagDecl::isInterface ( ) const [inline]
bool clang::TagDecl::isStruct ( ) const [inline]

isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the type. Provided for consistency.

Definition at line 2728 of file Decl.h.

Referenced by clang::ClassTemplateDecl::isThisDeclarationADefinition(), clang::Sema::ParseTypedefDecl(), and clang::ASTDeclWriter::VisitCXXRecordDecl().

bool clang::TagDecl::isUnion ( ) const [inline]

Definition at line 2783 of file Decl.h.

Referenced by clang::ASTDeclReader::VisitTagDecl().

Definition at line 2785 of file Decl.h.

Referenced by clang::ASTDeclReader::VisitTagDecl().

Definition at line 2838 of file Decl.h.

Referenced by clang::Sema::BuildVariableInstantiation().

void clang::TagDecl::setEmbeddedInDeclarator ( bool  isInDeclarator) [inline]

Definition at line 2752 of file Decl.h.

Referenced by GetDeclSpecTypeForDeclarator(), and clang::ASTDeclReader::VisitTagDecl().

void clang::TagDecl::setFreeStanding ( bool  isFreeStanding = true) [inline]
void clang::TagDecl::setTagKind ( TagKind  TK) [inline]

Definition at line 2797 of file Decl.h.

Referenced by clang::Sema::InstantiateClass(), and clang::ASTDeclReader::VisitTagDecl().

void TagDecl::setTemplateParameterListsInfo ( ASTContext Context,
unsigned  NumTPLists,
TemplateParameterList **  TPLists 
)

Friends And Related Function Documentation

friend class ASTDeclReader [friend]
friend class ASTDeclWriter [friend]

Member Data Documentation

IsBeingDefined - True if this is currently being defined.

Definition at line 2608 of file Decl.h.

Referenced by completeDefinition(), clang::CXXRecordDecl::CreateLambda(), and startDefinition().

Has the full definition of this type been required by a use somewhere in the TU.

Definition at line 2645 of file Decl.h.

IsFixed - True if this is an enumeration with fixed underlying type. Only possible in C++11, Microsoft extensions, or Objective C mode.

Definition at line 2635 of file Decl.h.

Referenced by clang::ASTDeclReader::VisitEnumDecl().

IsScoped - True if this tag declaration is a scoped enumeration. Only possible in C++11 mode.

Definition at line 2626 of file Decl.h.

Referenced by clang::ASTDeclReader::VisitEnumDecl().

IsScopedUsingClassTag - If this tag declaration is a scoped enum, then this is true if the scoped enum was declared using the class tag, false if it was declared with the struct tag. No meaning is associated if this tag declaration is not a scoped enum.

Definition at line 2631 of file Decl.h.

Referenced by clang::ASTDeclReader::VisitEnumDecl().

Definition at line 2622 of file Decl.h.

Definition at line 2621 of file Decl.h.


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