clang API Documentation
#include <Decl.h>
Public Member Functions | |
unsigned | getFieldIndex () const |
bool | isMutable () const |
isMutable - Determines whether this field is mutable (C++ only). | |
bool | isBitField () const |
Determines whether this field is a bitfield. | |
bool | isUnnamedBitfield () const |
Determines whether this is an unnamed bitfield. | |
bool | isAnonymousStructOrUnion () const |
Expr * | getBitWidth () const |
unsigned | getBitWidthValue (const ASTContext &Ctx) const |
void | setBitWidth (Expr *Width) |
setBitWidth - Set the bit-field width for this member. | |
void | removeBitWidth () |
removeBitWidth - Remove the bit-field width from this member. | |
InClassInitStyle | getInClassInitStyle () const |
bool | hasInClassInitializer () const |
Expr * | getInClassInitializer () const |
void | setInClassInitializer (Expr *Init) |
void | removeInClassInitializer () |
bool | hasCapturedVLAType () const |
Determine whether this member captures the variable length array type. | |
const VariableArrayType * | getCapturedVLAType () const |
Get the captured variable length array type. | |
void | setCapturedVLAType (const VariableArrayType *VLAType) |
Set the captured variable length array type for this field. | |
const RecordDecl * | getParent () const |
RecordDecl * | getParent () |
SourceRange | getSourceRange () const override LLVM_READONLY |
Source range that this declaration covers. | |
FieldDecl * | getCanonicalDecl () override |
Retrieves the canonical declaration of this field. | |
const FieldDecl * | getCanonicalDecl () const |
Static Public Member Functions | |
static FieldDecl * | Create (const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle) |
static FieldDecl * | CreateDeserialized (ASTContext &C, unsigned ID) |
static bool | classof (const Decl *D) |
static bool | classofKind (Kind K) |
Protected Member Functions | |
FieldDecl (Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle) | |
Friends | |
class | ASTDeclReader |
class | ASTDeclWriter |
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struct/union/class.
clang::FieldDecl::FieldDecl | ( | Kind | DK, |
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
IdentifierInfo * | Id, | ||
QualType | T, | ||
TypeSourceInfo * | TInfo, | ||
Expr * | BW, | ||
bool | Mutable, | ||
InClassInitStyle | InitStyle | ||
) | [inline, protected] |
Definition at line 2206 of file Decl.h.
References clang::ICIS_NoInit.
Referenced by Create(), and CreateDeserialized().
static bool clang::FieldDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::DeclaratorDecl.
Reimplemented in clang::ObjCAtDefsFieldDecl, and clang::ObjCIvarDecl.
Definition at line 2342 of file Decl.h.
References clang::Decl::getKind().
static bool clang::FieldDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::DeclaratorDecl.
Reimplemented in clang::ObjCAtDefsFieldDecl, and clang::ObjCIvarDecl.
Definition at line 2343 of file Decl.h.
Referenced by isFieldOrIndirectField().
FieldDecl * FieldDecl::Create | ( | const ASTContext & | C, |
DeclContext * | DC, | ||
SourceLocation | StartLoc, | ||
SourceLocation | IdLoc, | ||
IdentifierInfo * | Id, | ||
QualType | T, | ||
TypeSourceInfo * | TInfo, | ||
Expr * | BW, | ||
bool | Mutable, | ||
InClassInitStyle | InitStyle | ||
) | [static] |
Definition at line 3261 of file Decl.cpp.
References AttributeLangSupport::C, and FieldDecl().
Referenced by addAsFieldToClosureType(), clang::Sema::BuildAnonymousStructOrUnion(), clang::Sema::buildInitCaptureField(), clang::Sema::BuildMicrosoftCAnonymousStruct(), captureInCapturedRegion(), captureThis(), clang::Sema::CheckFieldDecl(), CreateAAPCSABIBuiltinVaListDecl(), CreateAArch64ABIBuiltinVaListDecl(), CreatePowerABIBuiltinVaListDecl(), CreateSystemZBuiltinVaListDecl(), CreateX86_64ABIBuiltinVaListDecl(), clang::CodeGen::CodeGenModule::GetAddrOfConstantString(), clang::ASTContext::getBlockDescriptorExtendedType(), clang::ASTContext::getBlockDescriptorType(), clang::ASTContext::getCFConstantStringType(), clang::CodeGen::CodeGenModule::getObjCFastEnumerationStateType(), clang::Sema::tryCaptureVariable(), and clang::ASTNodeImporter::VisitFieldDecl().
FieldDecl * FieldDecl::CreateDeserialized | ( | ASTContext & | C, |
unsigned | ID | ||
) | [static] |
Reimplemented in clang::ObjCAtDefsFieldDecl, and clang::ObjCIvarDecl.
Definition at line 3270 of file Decl.cpp.
References AttributeLangSupport::C, FieldDecl(), and clang::ICIS_NoInit.
Expr* clang::FieldDecl::getBitWidth | ( | ) | const [inline] |
Definition at line 2247 of file Decl.h.
Referenced by clang::Sema::ActOnDefs(), clang::Sema::CheckImplementationIvars(), clang::ASTDeclWriter::VisitFieldDecl(), clang::ASTNodeImporter::VisitFieldDecl(), clang::ASTDeclWriter::VisitObjCIvarDecl(), and clang::ASTNodeImporter::VisitObjCIvarDecl().
unsigned FieldDecl::getBitWidthValue | ( | const ASTContext & | Ctx | ) | const |
Definition at line 3286 of file Decl.cpp.
References clang::Expr::EvaluateKnownConstInt(), and isBitField().
Referenced by clang::Sema::ActOnLastBitfield(), BuildImplicitMemberInitializer(), clang::Sema::CheckImplementationIvars(), clang::CodeGen::CodeGenTypes::ComputeRecordLayout(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), clang::CodeGen::CGObjCRuntime::EmitValueForIvarAtOffset(), EncodeBitField(), clang::ASTContext::isPromotableBitField(), IsStructurallyEquivalent(), and truncateBitfieldValue().
FieldDecl* clang::FieldDecl::getCanonicalDecl | ( | ) | [inline, override, virtual] |
Retrieves the canonical declaration of this field.
Reimplemented from clang::Decl.
Definition at line 2338 of file Decl.h.
Referenced by CollectFieldInitializer(), findSubobject(), clang::CodeGen::CGRecordLayout::getBitFieldInfo(), getFieldIndex(), GetKeyForMember(), clang::CodeGen::CGRecordLayout::getLLVMFieldNo(), PopulateKeysForFields(), and clang::Sema::SetCtorInitializers().
const FieldDecl* clang::FieldDecl::getCanonicalDecl | ( | ) | const [inline] |
Reimplemented from clang::Decl.
const VariableArrayType* clang::FieldDecl::getCapturedVLAType | ( | ) | const [inline] |
unsigned FieldDecl::getFieldIndex | ( | ) | const |
getFieldIndex - Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::getFieldOffset.
Definition at line 3292 of file Decl.cpp.
References getCanonicalDecl(), getFieldIndex(), and getParent().
Referenced by clang::CodeGen::CodeGenFunction::EmitLValueForField(), EncodeBitField(), getFieldIndex(), getFieldOffset(), HandleConstructorCall(), HandleLValueMember(), and clang::Sema::LookupInlineAsmField().
Expr* clang::FieldDecl::getInClassInitializer | ( | ) | const [inline] |
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not been set. If a valid declaration has an in-class initializer, but this returns null, then we have not parsed and attached it yet.
Definition at line 2288 of file Decl.h.
Referenced by clang::Sema::BuildCXXDefaultInitExpr(), clang::CXXDefaultInitExpr::getExpr(), clang::CXXCtorInitializer::getSourceRange(), clang::Expr::HasSideEffects(), clang::Sema::InstantiateInClassInitializer(), and clang::ASTNodeImporter::VisitFieldDecl().
InClassInitStyle clang::FieldDecl::getInClassInitStyle | ( | ) | const [inline] |
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has.
Definition at line 2272 of file Decl.h.
References clang::ICIS_NoInit.
Referenced by clang::Sema::ActOnFinishCXXInClassMemberInitializer(), clang::Sema::InstantiateInClassInitializer(), and clang::ASTNodeImporter::VisitFieldDecl().
const RecordDecl* clang::FieldDecl::getParent | ( | ) | const [inline] |
getParent - Returns the parent of this field declaration, which is the struct in which this method is defined.
Definition at line 2327 of file Decl.h.
Referenced by clang::Sema::ActOnCXXMemberDeclarator(), clang::Sema::BuildBuiltinOffsetOf(), clang::Sema::BuildCXXDefaultInitExpr(), BuildImplicitMemberInitializer(), clang::Sema::CheckNontrivialField(), EmitCapturedFieldLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitLValueForFieldInitialization(), clang::CodeGen::CodeGenFunction::EmitLValueForLambdaField(), EncodeBitField(), evalBinOpFieldRegionFieldRegion(), clang::ento::MemRegion::getAsOffset(), getFieldIndex(), getFieldOffset(), HandleConstructorCall(), HandleLValueMember(), clang::Sema::InstantiateInClassInitializer(), isUnionField(), setCapturedVLAType(), and clang::Sema::SetCtorInitializers().
RecordDecl* clang::FieldDecl::getParent | ( | ) | [inline] |
SourceRange FieldDecl::getSourceRange | ( | ) | const [override, virtual] |
Source range that this declaration covers.
Reimplemented from clang::DeclaratorDecl.
Definition at line 3311 of file Decl.cpp.
References clang::DeclaratorDecl::getInnerLocStart().
bool clang::FieldDecl::hasCapturedVLAType | ( | ) | const [inline] |
bool clang::FieldDecl::hasInClassInitializer | ( | ) | const [inline] |
hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.
Definition at line 2280 of file Decl.h.
References clang::ICIS_NoInit.
Referenced by clang::Sema::BuildCXXDefaultInitExpr(), CollectFieldInitializer(), clang::Sema::InstantiateInClassInitializer(), clang::ASTDeclWriter::VisitFieldDecl(), and clang::ASTNodeImporter::VisitFieldDecl().
bool FieldDecl::isAnonymousStructOrUnion | ( | ) | const |
isAnonymousStructOrUnion - Determines whether this field is a representative for an anonymous struct or union. Such fields are unnamed and are implicitly generated by the implementation to store the data for the anonymous union or struct.
Definition at line 3276 of file Decl.cpp.
References clang::NamedDecl::getDeclName(), clang::ValueDecl::getType(), clang::Decl::isImplicit(), and Record.
Referenced by clang::Sema::ActOnFields(), CheckConstexprCtorInitializer(), and IsStructurallyEquivalent().
bool clang::FieldDecl::isBitField | ( | ) | const [inline] |
Determines whether this field is a bitfield.
Definition at line 2233 of file Decl.h.
Referenced by clang::Sema::ActOnLastBitfield(), clang::Sema::BuildBuiltinOffsetOf(), clang::Sema::BuildDeclRefExpr(), BuildFieldReferenceExpr(), BuildImplicitMemberInitializer(), clang::Sema::CheckImplementationIvars(), clang::CodeGen::CodeGenTypes::ComputeRecordLayout(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), clang::CodeGen::CodeGenFunction::EmitAsanPrologueOrEpilogue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), EmitNullConstant(), clang::CodeGen::CGObjCRuntime::EmitValueForIvarAtOffset(), EncodeBitField(), findSubobject(), clang::CodeGen::CGRecordLayout::getBitFieldInfo(), getBitWidthValue(), HandleConstructorCall(), isIntegerLikeType(), IsStructurallyEquivalent(), and truncateBitfieldValue().
bool clang::FieldDecl::isMutable | ( | ) | const [inline] |
isMutable - Determines whether this field is mutable (C++ only).
Definition at line 2230 of file Decl.h.
Referenced by BuildFieldReferenceExpr(), clang::ASTDeclWriter::VisitFieldDecl(), and clang::ASTNodeImporter::VisitFieldDecl().
bool clang::FieldDecl::isUnnamedBitfield | ( | ) | const [inline] |
Determines whether this is an unnamed bitfield.
Definition at line 2239 of file Decl.h.
Referenced by CheckConstexprCtorInitializer(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), DiagnoseBaseOrMemInitializerOrder(), GetNumNonZeroBytesInInit(), and isEmptyField().
void clang::FieldDecl::removeBitWidth | ( | ) | [inline] |
void clang::FieldDecl::removeInClassInitializer | ( | ) | [inline] |
removeInClassInitializer - Remove the C++11 in-class initializer from this member.
Definition at line 2305 of file Decl.h.
Referenced by clang::Sema::ActOnFinishCXXInClassMemberInitializer().
void clang::FieldDecl::setBitWidth | ( | Expr * | Width | ) | [inline] |
void FieldDecl::setCapturedVLAType | ( | const VariableArrayType * | VLAType | ) |
Set the captured variable length array type for this field.
Definition at line 3327 of file Decl.cpp.
References getParent().
void clang::FieldDecl::setInClassInitializer | ( | Expr * | Init | ) | [inline] |
setInClassInitializer - Set the C++11 in-class initializer for this member.
Definition at line 2296 of file Decl.h.
Referenced by clang::Sema::ActOnFinishCXXInClassMemberInitializer(), and clang::ASTNodeImporter::VisitFieldDecl().
friend class ASTDeclReader [friend] |
Reimplemented from clang::DeclaratorDecl.
friend class ASTDeclWriter [friend] |
Reimplemented from clang::DeclaratorDecl.