clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::EnumDecl Class Reference

#include <Decl.h>

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

List of all members.

Public Types

typedef specific_decl_iterator
< EnumConstantDecl
enumerator_iterator
typedef llvm::iterator_range
< specific_decl_iterator
< EnumConstantDecl >
> enumerator_range;enumerator_range
enumerators() const {return
enumerator_range(enumerator_begin(),
enumerator_end());}enumerator_iterator
enumerator_begin() const
{const EnumDecl *E=getDefinition();if(!E)
E=this;return
enumerator_iterator(E->
decls_begin());}enumerator_iterator
enumerator_end() const {const
EnumDecl *E=getDefinition();if(!E)
E=this;return
enumerator_iterator(E-> 
decls_end ())

Public Member Functions

EnumDeclgetCanonicalDecl () override
 Retrieves the "canonical" declaration of the given declaration.
const EnumDeclgetCanonicalDecl () const
EnumDeclgetPreviousDecl ()
 Return the previous declaration of this declaration or NULL if this is the first declaration.
const EnumDeclgetPreviousDecl () const
EnumDeclgetMostRecentDecl ()
 Returns the most recent (re)declaration of this declaration.
const EnumDeclgetMostRecentDecl () const
 Returns the most recent (re)declaration of this declaration.
EnumDeclgetDefinition () const
void completeDefinition (QualType NewType, QualType PromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits)
QualType getPromotionType () const
void setPromotionType (QualType T)
 Set the promotion type.
QualType getIntegerType () const
void setIntegerType (QualType T)
 Set the underlying integer type.
void setIntegerTypeSourceInfo (TypeSourceInfo *TInfo)
 Set the underlying integer type source info.
TypeSourceInfogetIntegerTypeSourceInfo () const
 Return the type source info for the underlying integer type, if no type source info exists, return 0.
SourceRange getIntegerTypeRange () const LLVM_READONLY
 Retrieve the source range that covers the underlying type if specified.
unsigned getNumPositiveBits () const
 Returns the width in bits required to store all the non-negative enumerators of this enum.
void setNumPositiveBits (unsigned Num)
unsigned getNumNegativeBits () const
 Returns the width in bits required to store all the negative enumerators of this enum. These widths include the rightmost leading 1; that is:
void setNumNegativeBits (unsigned Num)
bool isScoped () const
 Returns true if this is a C++11 scoped enumeration.
bool isScopedUsingClassTag () const
 Returns true if this is a C++11 scoped enumeration.
bool isFixed () const
 Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying type.
bool isComplete () const
 Returns true if this can be considered a complete type.
EnumDeclgetInstantiatedFromMemberEnum () const
 Returns the enumeration (declared within the template) from which this enumeration type was instantiated, or NULL if this enumeration was not instantiated from any template.
TemplateSpecializationKind getTemplateSpecializationKind () const
 If this enumeration is a member of a specialization of a templated class, determine what kind of template specialization or instantiation this is.
void setTemplateSpecializationKind (TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
 For an enumeration member that was instantiated from a member enumeration of a templated class, set the template specialiation kind.
MemberSpecializationInfogetMemberSpecializationInfo () const
 If this enumeration is an instantiation of a member enumeration of a class template specialization, retrieves the member specialization information.
void setInstantiationOfMemberEnum (EnumDecl *ED, TemplateSpecializationKind TSK)
 Specify that this enumeration is an instantiation of the member enumeration ED.

Static Public Member Functions

static EnumDeclCreate (ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
static EnumDeclCreateDeserialized (ASTContext &C, unsigned ID)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Friends

class ASTDeclReader

Detailed Description

EnumDecl - Represents an enum. In C++11, enums can be forward-declared with a fixed underlying type, and in C we allow them to be forward-declared with no underlying type as an extension.

Definition at line 2887 of file Decl.h.


Member Typedef Documentation

typedef llvm::iterator_range<specific_decl_iterator<EnumConstantDecl>> enumerator_range; enumerator_range enumerators() const { return enumerator_range(enumerator_begin(), enumerator_end()); } enumerator_iterator enumerator_begin() const { const EnumDecl *E = getDefinition(); if (!E) E = this; return enumerator_iterator(E->decls_begin()); } enumerator_iterator enumerator_end() const { const EnumDecl *E = getDefinition(); if (!E) E = this; return enumerator_iterator(E-> clang::EnumDecl::decls_end())

Definition at line 2998 of file Decl.h.

Definition at line 2979 of file Decl.h.


Member Function Documentation

static bool clang::EnumDecl::classof ( const Decl D) [inline, static]

Reimplemented from clang::TagDecl.

Definition at line 3111 of file Decl.h.

References clang::Decl::getKind().

static bool clang::EnumDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::TagDecl.

Definition at line 3112 of file Decl.h.

void EnumDecl::completeDefinition ( QualType  NewType,
QualType  PromotionType,
unsigned  NumPositiveBits,
unsigned  NumNegativeBits 
)

completeDefinition - When created, the EnumDecl corresponds to a forward-declared enum. This method is used to mark the declaration as being defined; it's enumerators have already been added (via DeclContext::addDecl). NewType is the new underlying type of the enumeration type.

Definition at line 3472 of file Decl.cpp.

References clang::TagDecl::completeDefinition(), clang::QualType::getTypePtr(), clang::TagDecl::isCompleteDefinition(), setNumNegativeBits(), and setNumPositiveBits().

Referenced by clang::Sema::ActOnEnumBody(), and clang::ASTNodeImporter::ImportDefinition().

EnumDecl * EnumDecl::Create ( ASTContext C,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
IdentifierInfo Id,
EnumDecl PrevDecl,
bool  IsScoped,
bool  IsScopedUsingClassTag,
bool  IsFixed 
) [static]
EnumDecl* clang::EnumDecl::getCanonicalDecl ( ) [inline, override, virtual]

Retrieves the "canonical" declaration of the given declaration.

Reimplemented from clang::TagDecl.

Definition at line 2934 of file Decl.h.

References clang::TagDecl::getCanonicalDecl().

Referenced by isInstantiationOf(), and clang::ASTDeclReader::VisitEnumDecl().

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

Reimplemented from clang::TagDecl.

Definition at line 2937 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 from clang::TagDecl.

Definition at line 2956 of file Decl.h.

References getDefinition().

Referenced by appendEnumType(), clang::Sema::CodeCompleteCase(), clang::ASTNodeImporter::ImportDefinition(), clang::Sema::InstantiateClassMembers(), clang::Sema::InstantiateEnum(), and clang::Sema::InstantiateVariableDefinition().

Returns the enumeration (declared within the template) from which this enumeration type was instantiated, or NULL if this enumeration was not instantiated from any template.

Definition at line 3503 of file Decl.cpp.

References clang::MemberSpecializationInfo::getInstantiatedFrom().

Referenced by clang::Sema::CheckMemberSpecialization(), clang::Sema::InstantiateClassMembers(), clang::Sema::InstantiateEnum(), isInstantiationOf(), and clang::Sema::RequireCompleteDeclContext().

Retrieve the source range that covers the underlying type if specified.

Definition at line 3466 of file Decl.cpp.

References getIntegerTypeSourceInfo().

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

Return the type source info for the underlying integer type, if no type source info exists, return 0.

Definition at line 3027 of file Decl.h.

Referenced by getIntegerTypeRange(), and clang::ASTDeclWriter::VisitEnumDecl().

If this enumeration is an instantiation of a member enumeration of a class template specialization, retrieves the member specialization information.

Definition at line 3100 of file Decl.h.

Referenced by clang::Sema::CheckMemberSpecialization(), getTemplateSpecializationKind(), clang::Sema::InstantiateEnum(), clang::Sema::RequireCompleteDeclContext(), setTemplateSpecializationKind(), clang::ASTDeclWriter::VisitEnumDecl(), and clang::ASTDeclReader::VisitEnumDecl().

Returns the most recent (re)declaration of this declaration.

Reimplemented from clang::Redeclarable< TagDecl >.

Definition at line 2949 of file Decl.h.

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

const EnumDecl* clang::EnumDecl::getMostRecentDecl ( ) const [inline]

Returns the most recent (re)declaration of this declaration.

Reimplemented from clang::Redeclarable< TagDecl >.

Definition at line 2952 of file Decl.h.

Returns the width in bits required to store all the negative enumerators of this enum. These widths include the rightmost leading 1; that is:

MOST NEGATIVE ENUMERATOR PATTERN NUM NEGATIVE BITS ------------------------ ------- ----------------- -1 1111111 1 -10 1110110 5 -101 1001011 8

Definition at line 3054 of file Decl.h.

Referenced by CheckForDuplicateEnumValues(), getRangeForType(), clang::ASTNodeImporter::ImportDefinition(), and clang::ASTDeclWriter::VisitEnumDecl().

Returns the width in bits required to store all the non-negative enumerators of this enum.

Definition at line 3037 of file Decl.h.

Referenced by CheckForDuplicateEnumValues(), getRangeForType(), clang::ASTNodeImporter::ImportDefinition(), and clang::ASTDeclWriter::VisitEnumDecl().

Return the previous declaration of this declaration or NULL if this is the first declaration.

Reimplemented from clang::Redeclarable< TagDecl >.

Definition at line 2941 of file Decl.h.

Referenced by clang::ASTContext::getEnumType().

const EnumDecl* clang::EnumDecl::getPreviousDecl ( ) const [inline]

Reimplemented from clang::Redeclarable< TagDecl >.

Definition at line 2945 of file Decl.h.

getPromotionType - Return the integer type that enumerators should promote to.

Definition at line 3003 of file Decl.h.

Referenced by clang::ASTNodeImporter::ImportDefinition(), and clang::ASTDeclWriter::VisitEnumDecl().

If this enumeration is a member of a specialization of a templated class, determine what kind of template specialization or instantiation this is.

Definition at line 3485 of file Decl.cpp.

References getMemberSpecializationInfo(), and clang::TSK_Undeclared.

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

bool clang::EnumDecl::isComplete ( ) const [inline]

Returns true if this can be considered a complete type.

Definition at line 3078 of file Decl.h.

Referenced by getIntegerTypeForEnum(), and clang::IsEnumDeclComplete().

bool clang::EnumDecl::isFixed ( ) const [inline]
bool clang::EnumDecl::isScoped ( ) const [inline]

Returns true if this is a C++11 scoped enumeration.

Definition at line 3067 of file Decl.h.

Referenced by clang::ASTDeclWriter::VisitEnumDecl(), and clang::ASTNodeImporter::VisitEnumDecl().

void clang::EnumDecl::setInstantiationOfMemberEnum ( EnumDecl ED,
TemplateSpecializationKind  TSK 
) [inline]

Specify that this enumeration is an instantiation of the member enumeration ED.

Definition at line 3106 of file Decl.h.

Set the underlying integer type.

Definition at line 3020 of file Decl.h.

References clang::QualType::getTypePtrOrNull().

Referenced by clang::Sema::ActOnTag(), clang::ASTNodeImporter::VisitEnumDecl(), and clang::ASTDeclReader::VisitEnumDecl().

Set the underlying integer type source info.

Definition at line 3023 of file Decl.h.

Referenced by clang::Sema::ActOnTag(), and clang::ASTDeclReader::VisitEnumDecl().

Definition at line 3057 of file Decl.h.

Referenced by completeDefinition(), and clang::ASTDeclReader::VisitEnumDecl().

Definition at line 3040 of file Decl.h.

Referenced by completeDefinition(), and clang::ASTDeclReader::VisitEnumDecl().

Set the promotion type.

Definition at line 3006 of file Decl.h.

Referenced by clang::Sema::ActOnTag(), and clang::ASTDeclReader::VisitEnumDecl().


Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::TagDecl.

Definition at line 3114 of file Decl.h.


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