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.
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
bool isMsStruct (const ASTContext &C) const
bool mayInsertExtraPadding (bool EmitRemark=false) const
 Whether we are allowed to insert extra padding between fields. These padding are added to help AddressSanitizer detect intra-object-overflow bugs.

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


Member Typedef Documentation

Definition at line 3239 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 3527 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]

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

References 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(), clang::ASTNodeImporter::ImportDefinition(), 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 3165 of file Decl.h.

Referenced by getObjCBridgeAttr(), and clang::ASTDeclWriter::VisitRecordDecl().

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3168 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 3157 of file Decl.h.

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

Reimplemented from clang::Redeclarable< TagDecl >.

Reimplemented in clang::CXXRecordDecl.

Definition at line 3161 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 3187 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().

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

Definition at line 3570 of file Decl.cpp.

Referenced by isVLATypeCapturingAllowed().

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

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

Reimplemented in clang::CXXRecordDecl.

Definition at line 3564 of file Decl.cpp.

Referenced by isVLATypeCapturingAllowed().

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

References clang::ASTContext::getLangOpts().

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

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

Definition at line 3574 of file Decl.cpp.

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

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

Definition at line 3173 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 3144 of file Decl.h.


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