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

RecordDeclgetPreviousDecl ()
 Return the previous declaration of this declaration or NULL if this is the first declaration.
const RecordDeclgetPreviousDecl () const
RecordDeclgetMostRecentDecl ()
 Returns the most recent (re)declaration of this declaration.
const RecordDeclgetMostRecentDecl () const
 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
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)

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


Member Typedef Documentation

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

References clang::TagDecl::classof().

Referenced by Create(), and CreateDeserialized().


Member Function Documentation

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]

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

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

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

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3089 of file Decl.h.

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

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3082 of file Decl.h.

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

Referenced by clang::Sema::CheckUsingShadowDecl(), clang::CodeGen::CGDebugInfo::EmitGlobalVariable(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), FindDeclaringClass(), FindFirstNamedDataMember(), IsStructurallyEquivalent(), clang::Sema::MarkBaseAndMemberDestructorsReferenced(), PopulateKeysForFields(), clang::Sema::ShouldDeleteSpecialMember(), clang::ASTDeclWriter::VisitRecordDecl(), and clang::ASTNodeImporter::VisitRecordDecl().

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 3400 of file Decl.cpp.

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

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

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 3422 of file Decl.cpp.

References clang::ASTContext::getLangOpts().

Referenced by clang::Sema::CheckCompletedCXXClass(), and clang::Sema::CheckFieldDecl().

Definition at line 3094 of file Decl.h.

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


Friends And Related Function Documentation

friend class DeclContext [friend]

Reimplemented from clang::Decl.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3065 of file Decl.h.


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