clang API Documentation

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

#include <Decl.h>

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

List of all members.

Public Types

typedef specific_decl_iterator
< FieldDecl
field_iterator

Public Member Functions

const RecordDeclgetPreviousDecl () const
RecordDeclgetPreviousDecl ()
 Return the previous declaration of this declaration or NULL if this is the first declaration.
const RecordDeclgetMostRecentDecl () const
 Returns the most recent (re)declaration of this declaration.
RecordDeclgetMostRecentDecl ()
 Returns the most recent (re)declaration of this declaration.
bool hasFlexibleArrayMember () const
void setHasFlexibleArrayMember (bool V)
bool isAnonymousStructOrUnion () const
void setAnonymousStructOrUnion (bool Anon)
bool hasObjectMember () const
void setHasObjectMember (bool val)
bool isInjectedClassName () const
 Determines whether this declaration represents the injected class name.
RecordDeclgetDefinition () const
field_iterator field_begin () const
field_iterator field_end () const
bool field_empty () const
virtual void completeDefinition ()

Static Public Member Functions

static RecordDeclCreate (const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=0)
static RecordDeclCreateDeserialized (const ASTContext &C, unsigned ID)
static bool classof (const Decl *D)
static bool classof (const RecordDecl *D)
static bool classofKind (Kind K)

Protected Member Functions

 RecordDecl (Kind DK, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl)

Friends

class DeclContext

Detailed Description

RecordDecl - Represents a struct/union/class. For example: struct X; // Forward declaration, no "body". union Y { int A, B; }; // Has body with members A and B (FieldDecls). This decl will be marked invalid if *any* members are invalid.

Definition at line 2800 of file Decl.h.


Member Typedef Documentation

Definition at line 2900 of file Decl.h.


Constructor & Destructor Documentation

RecordDecl::RecordDecl ( Kind  DK,
TagKind  TK,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
IdentifierInfo Id,
RecordDecl PrevDecl 
) [protected]

Definition at line 2626 of file Decl.cpp.

References classof().

Referenced by Create(), and CreateDeserialized().


Member Function Documentation

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

Definition at line 2919 of file Decl.h.

static bool clang::RecordDecl::classofKind ( Kind  K) [inline, static]
void RecordDecl::completeDefinition ( ) [virtual]
RecordDecl * RecordDecl::Create ( const ASTContext C,
TagKind  TK,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
IdentifierInfo Id,
RecordDecl PrevDecl = 0 
) [static]
RecordDecl * RecordDecl::CreateDeserialized ( const ASTContext C,
unsigned  ID 
) [static]

Reimplemented in clang::CXXRecordDecl.

Definition at line 2646 of file Decl.cpp.

References clang::Decl::AllocateDeserializedDecl(), RecordDecl(), and clang::TTK_Struct.

RecordDecl::field_iterator RecordDecl::field_begin ( ) const

Definition at line 2657 of file Decl.cpp.

References clang::DeclContext::FirstDecl, and clang::DeclContext::hasExternalLexicalStorage().

Referenced by BitsContainNoUserData(), canExpandIndirectArgument(), CanSkipVTablePointerInitialization(), CheckASTMemory(), clang::Sema::CheckCompletedCXXClass(), CheckConstexprCtorInitializer(), clang::Sema::CheckConstexprFunctionBody(), clang::Sema::CheckTransparentUnionArgumentConstraints(), clang::Sema::CodeCompleteConstructorInitializer(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(), clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec(), clang::Sema::ComputeDefaultedDtorExceptionSpec(), clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedMoveCtorExceptionSpec(), clang::CodeGen::CodeGenTypes::ComputeRecordLayout(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), DiagnoseBaseOrMemInitializerOrder(), clang::Sema::DiagnoseNontrivial(), DumpCXXRecordLayout(), EmitNullConstant(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), FillInNullDataMemberPointers(), FindFirstNamedDataMember(), clang::CodeGen::CodeGenTypes::GetExpandedTypes(), clang::FieldDecl::getFieldIndex(), GetNumNonZeroBytesInInit(), HandleClassZeroInitialization(), HandleConstructorCall(), handleTransparentUnionAttr(), handleVecReturnAttr(), HasTrivialDestructorBody(), isEmptyRecord(), isHomogeneousAggregate(), isIntegerLikeType(), isRecordWithSSEVectorType(), isSafeToConvert(), isSingleElementStruct(), IsStructurallyEquivalent(), clang::IsTransparentUnionStandardConversion(), clang::LayoutOverrideSource::layoutRecordType(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), clang::ASTContext::mergeTransparentUnionType(), possibleTransparentUnionPointerType(), clang::CodeGen::CGRecordLayout::print(), clang::APValue::printPretty(), clang::Sema::RequireLiteralType(), clang::Sema::ShouldDeleteCopyAssignmentOperator(), clang::Sema::ShouldDeleteDestructor(), clang::Sema::ShouldDeleteMoveAssignmentOperator(), clang::Sema::ShouldDeleteSpecialMember(), and tryMatchRecordTypes().

bool clang::RecordDecl::field_empty ( ) const [inline]

Definition at line 2910 of file Decl.h.

field_iterator clang::RecordDecl::field_end ( ) const [inline]

Definition at line 2904 of file Decl.h.

Referenced by BitsContainNoUserData(), canExpandIndirectArgument(), CanSkipVTablePointerInitialization(), CheckASTMemory(), clang::Sema::CheckCompletedCXXClass(), CheckConstexprCtorInitializer(), clang::Sema::CheckConstexprFunctionBody(), clang::Sema::CheckTransparentUnionArgumentConstraints(), clang::Sema::CodeCompleteConstructorInitializer(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpecAndConst(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpecAndConst(), clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec(), clang::Sema::ComputeDefaultedDtorExceptionSpec(), clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedMoveCtorExceptionSpec(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), DiagnoseBaseOrMemInitializerOrder(), clang::Sema::DiagnoseNontrivial(), DumpCXXRecordLayout(), EmitNullConstant(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), FillInNullDataMemberPointers(), FindFirstNamedDataMember(), clang::CodeGen::CodeGenTypes::GetExpandedTypes(), clang::FieldDecl::getFieldIndex(), GetNumNonZeroBytesInInit(), HandleClassZeroInitialization(), HandleConstructorCall(), handleTransparentUnionAttr(), handleVecReturnAttr(), HasTrivialDestructorBody(), isEmptyRecord(), isHomogeneousAggregate(), isIntegerLikeType(), isRecordWithSSEVectorType(), isSafeToConvert(), isSingleElementStruct(), IsStructurallyEquivalent(), clang::IsTransparentUnionStandardConversion(), clang::LayoutOverrideSource::layoutRecordType(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), clang::ASTContext::mergeTransparentUnionType(), possibleTransparentUnionPointerType(), clang::APValue::printPretty(), clang::Sema::RequireLiteralType(), clang::Sema::ShouldDeleteCopyAssignmentOperator(), clang::Sema::ShouldDeleteDestructor(), clang::Sema::ShouldDeleteMoveAssignmentOperator(), clang::Sema::ShouldDeleteSpecialMember(), and tryMatchRecordTypes().

RecordDecl* clang::RecordDecl::getDefinition ( ) const [inline]

getDefinition - Returns the RecordDecl that actually defines this struct/union/class. When determining whether or not a struct/union/class is completely defined, one should use this method as opposed to 'isCompleteDefinition'. 'isCompleteDefinition' indicates whether or not a specific RecordDecl is a completed definition, not whether or not the record type is defined. This method returns NULL if there is no RecordDecl that defines the struct/union/tag.

Reimplemented from clang::TagDecl.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2893 of file Decl.h.

References clang::VarDecl::getDefinition().

Referenced by clang::Sema::BuildMicrosoftCAnonymousStruct(), clang::Sema::CheckBaseSpecifier(), clang::Sema::CheckClassTemplate(), clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(), clang::CXXRecordDecl::forallBases(), clang::ASTContext::getASTRecordLayout(), clang::ASTNodeImporter::ImportDefinition(), IsCompleteType(), IsStructurallyEquivalent(), and clang::ASTNodeImporter::VisitRecordDecl().

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

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2840 of file Decl.h.

References clang::Redeclarable< VarDecl >::getMostRecentDecl().

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

RecordDecl* clang::RecordDecl::getMostRecentDecl ( ) [inline]
const RecordDecl* clang::RecordDecl::getPreviousDecl ( ) const [inline]

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2833 of file Decl.h.

References clang::Redeclarable< VarDecl >::getPreviousDecl().

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

RecordDecl* clang::RecordDecl::getPreviousDecl ( ) [inline]

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2836 of file Decl.h.

References clang::Redeclarable< VarDecl >::getPreviousDecl().

bool clang::RecordDecl::hasFlexibleArrayMember ( ) const [inline]
bool clang::RecordDecl::hasObjectMember ( ) const [inline]
bool clang::RecordDecl::isAnonymousStructOrUnion ( ) const [inline]

isAnonymousStructOrUnion - Whether this is an anonymous struct or union. To be an anonymous struct or union, it must have been declared without a name and there must be no objects of this type declared, e.g.,

   union { int i; float f; };

is an anonymous union but neither of the following are:

  union X { int i; float f; };
  union { int i; float f; } obj;

Definition at line 2862 of file Decl.h.

Referenced by clang::Sema::CheckUsingShadowDecl(), FindDeclaringClass(), FindFirstNamedDataMember(), GetKeyForMember(), IsAccessible(), clang::Sema::ShouldDeleteCopyAssignmentOperator(), clang::Sema::ShouldDeleteDestructor(), clang::Sema::ShouldDeleteMoveAssignmentOperator(), clang::Sema::ShouldDeleteSpecialMember(), clang::TemplateDeclInstantiator::VisitCXXRecordDecl(), and clang::ASTDeclWriter::VisitRecordDecl().

bool RecordDecl::isInjectedClassName ( ) const

Determines whether this declaration represents the injected class name.

The injected class name in C++ is the name of the class that appears inside the class itself. For example:

 struct C {
   // C is implicitly declared here as a synonym for the class name.
 };

 C::C c; // same as "C c;"

Definition at line 2652 of file Decl.cpp.

References clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Decl::isImplicit(), and clang::DeclContext::isRecord().

Referenced by clang::Sema::ActOnStartCXXMemberDeclarations(), clang::ClassTemplateSpecializationDecl::getMostRecentDecl(), and clang::TemplateDeclInstantiator::VisitCXXRecordDecl().

void clang::RecordDecl::setAnonymousStructOrUnion ( bool  Anon) [inline]
void clang::RecordDecl::setHasFlexibleArrayMember ( bool  V) [inline]

Definition at line 2848 of file Decl.h.

Referenced by clang::Sema::ActOnFields(), and clang::ASTDeclReader::VisitRecordDecl().

void clang::RecordDecl::setHasObjectMember ( bool  val) [inline]

Friends And Related Function Documentation

friend class DeclContext [friend]

Reimplemented from clang::TypeDecl.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2820 of file Decl.h.


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