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

RecordDecl - Represents a struct/union/class. More...

#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
 isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
void setAnonymousStructOrUnion (bool Anon)
bool hasObjectMember () const
void setHasObjectMember (bool val)
bool hasVolatileMember () const
void setHasVolatileMember (bool val)
bool hasLoadedFieldsFromExternalStorage () const
void setHasLoadedFieldsFromExternalStorage (bool val)
bool isInjectedClassName () const
 Determines whether this declaration represents the injected class name.
bool isLambda () const
 Determine whether this record is a class describing a lambda function object.
bool isCapturedRecord () const
 Determine whether this record is a record for captured variables in CapturedStmt construct.
void setCapturedRecord ()
 Mark the record as a record for captured variables in CapturedStmt construct.
RecordDeclgetDefinition () const
 getDefinition - Returns the RecordDecl that actually defines this struct/union/class.
bool 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.
bool mayInsertExtraPadding (bool EmitRemark=false) const
 Whether we are allowed to insert extra padding between fields.
const FieldDeclfindFirstNamedDataMember () const
 Finds the first data member which has a name.

Static Public Member Functions

static RecordDeclCreate (const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
static RecordDeclCreateDeserialized (const ASTContext &C, unsigned ID)

Protected Member Functions

 RecordDecl (Kind DK, TagKind TK, const ASTContext &C, 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 3156 of file Decl.h.


Member Typedef Documentation

Definition at line 3282 of file Decl.h.


Constructor & Destructor Documentation

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

Definition at line 3694 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 = nullptr 
) [static]
RecordDecl * RecordDecl::CreateDeserialized ( const ASTContext C,
unsigned  ID 
) [static]
const FieldDecl * RecordDecl::findFirstNamedDataMember ( ) const

Finds the first data member which has a name.

nullptr is returned if no named data member exists.

Definition at line 3835 of file Decl.cpp.

References I.

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

References clang::VarDecl::getDefinition().

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

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

Referenced by getObjCBridgeAttr(), and clang::ASTDeclWriter::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 3204 of file Decl.h.

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

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

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

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

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3197 of file Decl.h.

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

bool clang::RecordDecl::hasFlexibleArrayMember ( ) const [inline]
bool clang::RecordDecl::hasLoadedFieldsFromExternalStorage ( ) const [inline]

Definition at line 3234 of file Decl.h.

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

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

bool RecordDecl::isCapturedRecord ( ) const

Determine whether this record is a record for captured variables in CapturedStmt construct.

Definition at line 3737 of file Decl.cpp.

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 3726 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::isLambda ( ) const

Determine whether this record is a class describing a lambda function object.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3731 of file Decl.cpp.

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

References clang::ASTContext::getLangOpts().

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

bool RecordDecl::mayInsertExtraPadding ( bool  EmitRemark = false) const
void clang::RecordDecl::setAnonymousStructOrUnion ( bool  Anon) [inline]
void RecordDecl::setCapturedRecord ( )

Mark the record as a record for captured variables in CapturedStmt construct.

Definition at line 3741 of file Decl.cpp.

References clang::Decl::addAttr(), and clang::Decl::getASTContext().

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

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

Definition at line 3209 of file Decl.h.

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

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

Definition at line 3237 of file Decl.h.

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::Decl.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3180 of file Decl.h.


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