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 hasVolatileMember () const
void setHasVolatileMember (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 ()
bool isMsStruct (const ASTContext &C) const

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 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 2898 of file Decl.h.


Member Typedef Documentation

Definition at line 3005 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 3092 of file Decl.cpp.

References classof().

Referenced by Create(), and CreateDeserialized().


Member Function Documentation

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

Reimplemented from clang::TagDecl.

Reimplemented in clang::ClassTemplatePartialSpecializationDecl, clang::ClassTemplateSpecializationDecl, and clang::CXXRecordDecl.

Definition at line 3023 of file Decl.h.

References clang::Decl::getKind().

Referenced by RecordDecl().

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]
RecordDecl::field_iterator RecordDecl::field_begin ( ) const

Definition at line 3128 of file Decl.cpp.

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

Referenced by clang::Sema::ActOnCapturedRegionError(), clang::Sema::ActOnLambdaError(), clang::Sema::ActOnLambdaExpr(), BitsContainNoUserData(), canExpandIndirectArgument(), CanSkipVTablePointerInitialization(), clang::CodeGen::CodeGenFunction::CGCapturedStmtInfo::CGCapturedStmtInfo(), CheckASTMemory(), clang::Sema::CheckCompletedCXXClass(), CheckConstantExpression(), CheckConstexprCtorInitializer(), clang::Sema::CheckConstexprFunctionBody(), clang::Sema::CheckTransparentUnionArgumentConstraints(), checkTrivialClassMembers(), clang::Sema::CodeCompleteConstructorInitializer(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpec(), clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec(), clang::Sema::ComputeDefaultedDtorExceptionSpec(), clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedMoveCtorExceptionSpec(), clang::Sema::ComputeInheritingCtorExceptionSpec(), clang::CodeGen::CodeGenTypes::ComputeRecordLayout(), defaultedSpecialMemberIsConstexpr(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), DiagnoseBaseOrMemInitializerOrder(), DiagnoseUninitializedReference(), DumpCXXRecordLayout(), clang::CodeGen::CodeGenFunction::EmitLambdaExpr(), EmitNullConstant(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), FillInNullDataMemberPointers(), FindFirstNamedDataMember(), clang::ento::MemRegion::getAsOffset(), clang::CXXRecordDecl::getCaptureFields(), clang::CodeGen::CodeGenTypes::GetExpandedTypes(), clang::FieldDecl::getFieldIndex(), GetNumNonZeroBytesInInit(), clang::CodeGen::CodeGenTBAA::getTBAAStructTypeInfo(), HandleClassZeroInitialization(), HandleConstructorCall(), handleTransparentUnionAttr(), handleVecReturnAttr(), HasTrivialDestructorBody(), InitCapturedStruct(), isCallbackArg(), isEmptyRecord(), isHomogeneousAggregate(), isIntegerLikeType(), isRecordWithSSEVectorType(), isSafeToConvert(), isSingleElementStruct(), IsStructurallyEquivalent(), clang::IsTransparentUnionStandardConversion(), clang::LayoutOverrideSource::layoutRecordType(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), clang::ASTContext::mergeTransparentUnionType(), PopulateKeysForFields(), possibleTransparentUnionPointerType(), clang::CodeGen::CGRecordLayout::print(), clang::APValue::printPretty(), clang::Sema::RequireLiteralType(), clang::Sema::ShouldDeleteSpecialMember(), subobjectsHaveMoveOrTrivialCopy(), and tryMatchRecordTypes().

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

Definition at line 3015 of file Decl.h.

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

Definition at line 3009 of file Decl.h.

Referenced by clang::Sema::ActOnCapturedRegionError(), clang::Sema::ActOnLambdaError(), clang::Sema::ActOnLambdaExpr(), BitsContainNoUserData(), canExpandIndirectArgument(), CanSkipVTablePointerInitialization(), CheckASTMemory(), clang::Sema::CheckCompletedCXXClass(), CheckConstantExpression(), CheckConstexprCtorInitializer(), clang::Sema::CheckConstexprFunctionBody(), clang::Sema::CheckTransparentUnionArgumentConstraints(), checkTrivialClassMembers(), clang::Sema::CodeCompleteConstructorInitializer(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpec(), clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec(), clang::Sema::ComputeDefaultedDtorExceptionSpec(), clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedMoveCtorExceptionSpec(), clang::Sema::ComputeInheritingCtorExceptionSpec(), defaultedSpecialMemberIsConstexpr(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), DiagnoseBaseOrMemInitializerOrder(), DiagnoseUninitializedReference(), DumpCXXRecordLayout(), EmitNullConstant(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), FillInNullDataMemberPointers(), FindFirstNamedDataMember(), clang::ento::MemRegion::getAsOffset(), clang::CodeGen::CodeGenTypes::GetExpandedTypes(), clang::FieldDecl::getFieldIndex(), GetNumNonZeroBytesInInit(), clang::CodeGen::CodeGenTBAA::getTBAAStructTypeInfo(), HandleClassZeroInitialization(), HandleConstructorCall(), handleTransparentUnionAttr(), handleVecReturnAttr(), HasTrivialDestructorBody(), isCallbackArg(), isEmptyRecord(), isHomogeneousAggregate(), isIntegerLikeType(), isRecordWithSSEVectorType(), isSafeToConvert(), isSingleElementStruct(), IsStructurallyEquivalent(), clang::IsTransparentUnionStandardConversion(), clang::LayoutOverrideSource::layoutRecordType(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), clang::ASTContext::mergeTransparentUnionType(), PopulateKeysForFields(), possibleTransparentUnionPointerType(), clang::APValue::printPretty(), clang::Sema::RequireLiteralType(), clang::Sema::ShouldDeleteSpecialMember(), subobjectsHaveMoveOrTrivialCopy(), 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 2998 of file Decl.h.

References getDefinition().

Referenced by clang::Sema::BuildMicrosoftCAnonymousStruct(), clang::Sema::CheckBaseSpecifier(), clang::Sema::CheckClassTemplate(), clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(), clang::CXXRecordDecl::forallBases(), clang::ASTContext::getASTRecordLayout(), clang::CodeGen::CodeGenTBAA::getTBAAStructTypeInfo(), clang::ASTNodeImporter::ImportDefinition(), IsCompleteType(), IsStructurallyEquivalent(), isTBAAPathStruct(), 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 2942 of file Decl.h.

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

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

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

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::ClassTemplatePartialSpecializationDecl, clang::ClassTemplateSpecializationDecl, and clang::CXXRecordDecl.

Definition at line 2945 of file Decl.h.

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

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2935 of file Decl.h.

References 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 2938 of file Decl.h.

References getPreviousDecl().

bool clang::RecordDecl::hasFlexibleArrayMember ( ) const [inline]
bool clang::RecordDecl::hasObjectMember ( ) const [inline]
bool clang::RecordDecl::hasVolatileMember ( ) 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 2964 of file Decl.h.

Referenced by clang::Sema::CheckUsingShadowDecl(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), FindDeclaringClass(), FindFirstNamedDataMember(), IsStructurallyEquivalent(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), PopulateKeysForFields(), clang::Sema::ShouldDeleteSpecialMember(), clang::TemplateDeclInstantiator::VisitCXXRecordDecl(), clang::ASTDeclWriter::VisitRecordDecl(), and clang::ASTNodeImporter::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 3123 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().

bool RecordDecl::isMsStruct ( const ASTContext C) const

isMsStrust - Get whether or not this is an ms_struct which can be turned on with an attribute, pragma, or -mms-bitfields commandline option.

isMsStruct - Get whether or not this record uses ms_struct layout. This which can be turned on with an attribute, pragma, or the -mms-bitfields command-line option.

Definition at line 3145 of file Decl.cpp.

References clang::ASTContext::getLangOpts().

Referenced by clang::CodeGen::CodeGenTypes::ComputeRecordLayout(), clang::FieldDecl::getFieldIndex(), and clang::CodeGen::CodeGenTBAA::getTBAAStructTypeInfo().

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

Definition at line 2950 of file Decl.h.

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

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

Friends And Related Function Documentation

friend class DeclContext [friend]

Reimplemented from clang::TypeDecl.

Reimplemented in clang::CXXRecordDecl.

Definition at line 2922 of file Decl.h.


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