clang API Documentation
#include <Decl.h>
Public Types | |
typedef specific_decl_iterator < FieldDecl > | field_iterator |
Public Member Functions | |
RecordDecl * | getPreviousDecl () |
Return the previous declaration of this declaration or NULL if this is the first declaration. | |
const RecordDecl * | getPreviousDecl () const |
RecordDecl * | getMostRecentDecl () |
Returns the most recent (re)declaration of this declaration. | |
const RecordDecl * | getMostRecentDecl () 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. | |
RecordDecl * | getDefinition () 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 RecordDecl * | Create (const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr) |
static RecordDecl * | CreateDeserialized (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 |
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.
RecordDecl::RecordDecl | ( | Kind | DK, |
TagKind | TK, | ||
const ASTContext & | C, | ||
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
IdentifierInfo * | Id, | ||
RecordDecl * | PrevDecl | ||
) | [protected] |
Definition at line 3520 of file Decl.cpp.
References clang::TagDecl::classof().
Referenced by Create(), and CreateDeserialized().
RecordDecl * RecordDecl::Create | ( | const ASTContext & | C, |
TagKind | TK, | ||
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
IdentifierInfo * | Id, | ||
RecordDecl * | PrevDecl = nullptr |
||
) | [static] |
Definition at line 3533 of file Decl.cpp.
References AttributeLangSupport::C, clang::ASTContext::getLangOpts(), clang::ASTContext::getTypeDeclType(), clang::TagDecl::MayHaveOutOfDateDef, Record, and RecordDecl().
Referenced by clang::Sema::ActOnTag(), clang::ASTContext::buildImplicitRecord(), clang::Sema::CreateCapturedStmtRecordDecl(), and clang::ASTNodeImporter::VisitRecordDecl().
RecordDecl * RecordDecl::CreateDeserialized | ( | const ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Reimplemented in clang::CXXRecordDecl.
Definition at line 3544 of file Decl.cpp.
References AttributeLangSupport::C, clang::ASTContext::getLangOpts(), clang::TagDecl::MayHaveOutOfDateDef, Record, RecordDecl(), and clang::TTK_Struct.
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 3235 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().
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 3168 of file Decl.h.
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.
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 3160 of file Decl.h.
Referenced by clang::ASTContext::getRecordType().
const RecordDecl* clang::RecordDecl::getPreviousDecl | ( | ) | const [inline] |
Reimplemented from clang::Redeclarable< TagDecl >.
Reimplemented in clang::CXXRecordDecl.
bool clang::RecordDecl::hasFlexibleArrayMember | ( | ) | const [inline] |
Definition at line 3175 of file Decl.h.
Referenced by clang::Sema::ActOnFields(), clang::Sema::CheckBaseSpecifier(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), evenFlexibleArraySize(), getTypeExpansion(), isEmptyRecord(), clang::ABIInfo::isHomogeneousAggregate(), isIntegerLikeType(), isSingleElementStruct(), isTBAAPathStruct(), clang::Sema::SetCtorInitializers(), and clang::ASTDeclWriter::VisitRecordDecl().
bool clang::RecordDecl::hasObjectMember | ( | ) | const [inline] |
Definition at line 3195 of file Decl.h.
Referenced by clang::Sema::ActOnFields(), clang::Sema::CheckNontrivialField(), clang::CodeGen::CodeGenFunction::EmitAggregateCopy(), clang::CXXRecordDecl::setBases(), and clang::ASTDeclWriter::VisitRecordDecl().
bool clang::RecordDecl::hasVolatileMember | ( | ) | const [inline] |
Definition at line 3198 of file Decl.h.
Referenced by clang::Sema::ActOnFields(), clang::CodeGen::CodeGenFunction::hasVolatileMember(), clang::CXXRecordDecl::setBases(), and clang::ASTDeclWriter::VisitRecordDecl().
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 3190 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().
bool RecordDecl::isCapturedRecord | ( | ) | const |
Determine whether this record is a record for captured variables in CapturedStmt construct.
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 3552 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.
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 3588 of file Decl.cpp.
References clang::ASTContext::getLangOpts().
Referenced by clang::Sema::CheckCompletedCXXClass(), and clang::Sema::CheckFieldDecl().
bool RecordDecl::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.
Definition at line 3628 of file Decl.cpp.
References Context, clang::Decl::getASTContext(), clang::ASTContext::getDiagnostics(), clang::ASTContext::getLangOpts(), clang::Decl::getLocation(), clang::NamedDecl::getQualifiedNameAsString(), clang::ASTContext::getSanitizerBlacklist(), clang::SanitizerSet::has(), clang::Decl::hasAttr(), clang::CXXRecordDecl::hasTrivialDestructor(), clang::DeclContext::isExternCContext(), clang::CXXRecordDecl::isStandardLayout(), clang::CXXRecordDecl::isTriviallyCopyable(), clang::TagDecl::isUnion(), clang::DiagnosticsEngine::Report(), and clang::LangOptions::Sanitize.
Referenced by clang::CodeGen::CodeGenFunction::EmitAsanPrologueOrEpilogue(), clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(), and clang::CodeGen::CodeGenModule::TryEmitBaseDestructorAsAlias().
void clang::RecordDecl::setAnonymousStructOrUnion | ( | bool | Anon | ) | [inline] |
Definition at line 3191 of file Decl.h.
Referenced by clang::Sema::BuildAnonymousStructOrUnion(), clang::ASTNodeImporter::VisitRecordDecl(), and clang::ASTDeclReader::VisitRecordDeclImpl().
void RecordDecl::setCapturedRecord | ( | ) |
Mark the record as a record for captured variables in CapturedStmt construct.
Definition at line 3567 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 3176 of file Decl.h.
Referenced by clang::Sema::ActOnFields(), and clang::ASTDeclReader::VisitRecordDeclImpl().
void clang::RecordDecl::setHasObjectMember | ( | bool | val | ) | [inline] |
Definition at line 3196 of file Decl.h.
Referenced by clang::Sema::ActOnFields(), clang::CXXRecordDecl::setBases(), and clang::ASTDeclReader::VisitRecordDeclImpl().
void clang::RecordDecl::setHasVolatileMember | ( | bool | val | ) | [inline] |
Definition at line 3199 of file Decl.h.
Referenced by clang::Sema::ActOnFields(), clang::CXXRecordDecl::setBases(), and clang::ASTDeclReader::VisitRecordDeclImpl().
friend class DeclContext [friend] |
Reimplemented from clang::Decl.
Reimplemented in clang::CXXRecordDecl.