class FieldDecl
Declaration
class FieldDecl : public DeclaratorDecl, public Mergeable { /* full declaration omitted */ };
Description
Represents a member of a struct/union/class.
Declared at: clang/include/clang/AST/Decl.h:2873
Inherits from: DeclaratorDecl, Mergeable
Member Variables
- private unsigned int BitField
- private unsigned int Mutable
- private unsigned int CachedFieldIndex
- private llvm::PointerIntPair<void*, 2, InitStorageKind> InitStorage
- If the storage kind is ISK_InClassCopyInit or ISK_InClassListInit, but the initializer is null, then this field has an in-class initializer that has not yet been parsed and attached.
Inherited from Decl:
- protected NextInContextAndBits
- protected Access
- protected FromASTFile
- protected IdentifierNamespace
- protected CacheValidAndLinkage
Method Overview
- public static clang::FieldDecl * Create(const clang::ASTContext & C, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, clang::IdentifierInfo * Id, clang::QualType T, clang::TypeSourceInfo * TInfo, clang::Expr * BW, bool Mutable, clang::InClassInitStyle InitStyle)
- public static clang::FieldDecl * CreateDeserialized(clang::ASTContext & C, unsigned int ID)
- protected FieldDecl(clang::Decl::Kind DK, clang::DeclContext * DC, clang::SourceLocation StartLoc, clang::SourceLocation IdLoc, clang::IdentifierInfo * Id, clang::QualType T, clang::TypeSourceInfo * TInfo, clang::Expr * BW, bool Mutable, clang::InClassInitStyle InitStyle)
- public static bool classof(const clang::Decl * D)
- public static bool classofKind(clang::Decl::Kind K)
- public clang::Expr * getBitWidth() const
- public unsigned int getBitWidthValue(const clang::ASTContext & Ctx) const
- public const clang::FieldDecl * getCanonicalDecl() const
- public clang::FieldDecl * getCanonicalDecl()
- public const clang::VariableArrayType * getCapturedVLAType() const
- public unsigned int getFieldIndex() const
- public clang::InClassInitStyle getInClassInitStyle() const
- public clang::Expr * getInClassInitializer() const
- public const clang::RecordDecl * getParent() const
- public clang::RecordDecl * getParent()
- public clang::SourceRange getSourceRange() const
- public bool hasCapturedVLAType() const
- public bool hasInClassInitializer() const
- public bool isAnonymousStructOrUnion() const
- public bool isBitField() const
- public bool isMutable() const
- public bool isUnnamedBitfield() const
- public bool isZeroLengthBitField(const clang::ASTContext & Ctx) const
- public bool isZeroSize(const clang::ASTContext & Ctx) const
- public void removeBitWidth()
- public void removeInClassInitializer()
- public void setBitWidth(clang::Expr * Width)
- public void setCapturedVLAType(const clang::VariableArrayType * VLAType)
- public void setInClassInitializer(clang::Expr * Init)
Inherited from DeclaratorDecl:
- public classof
- public classofKind
- public getBeginLoc
- public getInnerLocStart
- public getNumTemplateParameterLists
- public getOuterLocStart
- public getQualifier
- public getQualifierLoc
- public getSourceRange
- public getTemplateParameterList
- public getTrailingRequiresClause
- public getTrailingRequiresClause
- public getTypeSourceInfo
- public getTypeSpecEndLoc
- public getTypeSpecStartLoc
- public setInnerLocStart
- public setQualifierInfo
- public setTemplateParameterListsInfo
- public setTrailingRequiresClause
- public setTypeSourceInfo
Inherited from ValueDecl:
Inherited from NamedDecl:
- public classof
- public classofKind
- public declarationReplaces
- public getDeclName
- public getExplicitVisibility
- public getFormalLinkage
- public getIdentifier
- public getLinkageAndVisibility
- public getLinkageInternal
- public getMostRecentDecl
- public getMostRecentDecl
- public getName
- public getNameAsString
- public getNameForDiagnostic
- public getObjCFStringFormattingFamily
- public getQualifiedNameAsString
- public getUnderlyingDecl
- public getUnderlyingDecl
- public getVisibility
- public hasExternalFormalLinkage
- public hasLinkage
- public hasLinkageBeenComputed
- public isCXXClassMember
- public isCXXInstanceMember
- public isExternallyDeclarable
- public isExternallyVisible
- public isLinkageValid
- public isReserved
- public printName
- public printNestedNameSpecifier
- public printNestedNameSpecifier
- public printQualifiedName
- public printQualifiedName
- public setDeclName
Inherited from Decl:
- public EnableStatistics
- public PrintStats
- public add
- public addAttr
- public attr_begin
- public attr_end
- public attrs
- public canBeWeakImported
- public castFromDeclContext
- public castToDeclContext
- public classofKind
- public dropAttr
- public dropAttrs
- public dump
- public dump
- public dumpColor
- public getASTContext
- protected getASTMutationListener
- public getAccess
- public getAccessUnsafe
- public getAsFunction
- public getAsFunction
- public getAttr
- public getAttrs
- public getAttrs
- public getAvailability
- public getBeginLoc
- public getBody
- public getBodyRBrace
- protected getCachedLinkage
- public getCanonicalDecl
- public getCanonicalDecl
- public getDeclContext
- public getDeclContext
- public getDeclKindName
- public getDefiningAttr
- public getDescribedTemplate
- public getDescribedTemplateParams
- public getEndLoc
- public getExternalSourceSymbolAttr
- public getFriendObjectKind
- public getFunctionType
- public getGlobalID
- public getID
- public getIdentifierNamespace
- public getIdentifierNamespaceForKind
- public getImportedOwningModule
- public getKind
- public getLangOpts
- public getLexicalDeclContext
- public getLexicalDeclContext
- public getLocalOwningModule
- public getLocation
- public getMaxAlignment
- public getModuleOwnershipKind
- public getMostRecentDecl
- public getMostRecentDecl
- protected getMostRecentDeclImpl
- public getNextDeclInContext
- public getNextDeclInContext
- protected getNextRedeclarationImpl
- public getNonClosureContext
- public getNonClosureContext
- public getOwningModule
- public getOwningModuleForLinkage
- public getOwningModuleID
- public getParentFunctionOrMethod
- public getParentFunctionOrMethod
- public getPreviousDecl
- public getPreviousDecl
- protected getPreviousDeclImpl
- public getSourceRange
- public getTemplateDepth
- public getTranslationUnitDecl
- public getTranslationUnitDecl
- public getVersionIntroduced
- public hasAttr
- public hasAttrs
- public hasBody
- protected hasCachedLinkage
- public hasDefiningAttr
- protected hasLocalOwningModuleStorage
- public hasOwningModule
- public hasTagIdentifierNamespace
- public isCanonicalDecl
- public isDefinedOutsideFunctionOrMethod
- public isDeprecated
- public isDiscardedInGlobalModuleFragment
- public isFirstDecl
- public isFromASTFile
- public isFunctionOrFunctionTemplate
- public isImplicit
- public isInAnonymousNamespace
- public isInExportDeclContext
- public isInIdentifierNamespace
- public isInLocalScopeForInstantiation
- public isInStdNamespace
- public isInvalidDecl
- public isInvisibleOutsideTheOwningModule
- public isLocalExternDecl
- public isModulePrivate
- public isOutOfLine
- public isParameterPack
- public isReachable
- public isReferenced
- public isTagIdentifierNamespace
- public isTemplateDecl
- public isTemplateParameter
- public isTemplateParameterPack
- public isTemplated
- public isThisDeclarationReferenced
- public isTopLevelDeclInObjCContainer
- public isUnavailable
- public isUnconditionallyVisible
- public isUsed
- public isWeakImported
- public markUsed
- public print
- public print
- public printGroup
- public redecls
- public redecls_begin
- public redecls_end
- public setAccess
- public setAttrs
- protected setCachedLinkage
- public setDeclContext
- public setFromASTFile
- public setImplicit
- public setInvalidDecl
- public setIsUsed
- public setLexicalDeclContext
- public setLocalExternDecl
- public setLocalOwningModule
- public setLocation
- public setModuleOwnershipKind
- protected setModulePrivate
- public setNonMemberOperator
- public setObjectOfFriendDecl
- public setOwningModuleID
- public setReferenced
- public setTopLevelDeclInObjCContainer
- public setVisibleDespiteOwningModule
- public specific_attr_begin
- public specific_attr_end
- public specific_attrs
- protected updateOutOfDate
Methods
¶static clang::FieldDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::Expr* BW,
bool Mutable,
clang::InClassInitStyle InitStyle)
static clang::FieldDecl* Create(
const clang::ASTContext& C,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::Expr* BW,
bool Mutable,
clang::InClassInitStyle InitStyle)
Declared at: clang/include/clang/AST/Decl.h:2935
Parameters
- const clang::ASTContext& C
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- clang::IdentifierInfo* Id
- clang::QualType T
- clang::TypeSourceInfo* TInfo
- clang::Expr* BW
- bool Mutable
- clang::InClassInitStyle InitStyle
¶static clang::FieldDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
static clang::FieldDecl* CreateDeserialized(
clang::ASTContext& C,
unsigned int ID)
Declared at: clang/include/clang/AST/Decl.h:2941
Parameters
- clang::ASTContext& C
- unsigned int ID
¶FieldDecl(clang::Decl::Kind DK,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::Expr* BW,
bool Mutable,
clang::InClassInitStyle InitStyle)
FieldDecl(clang::Decl::Kind DK,
clang::DeclContext* DC,
clang::SourceLocation StartLoc,
clang::SourceLocation IdLoc,
clang::IdentifierInfo* Id,
clang::QualType T,
clang::TypeSourceInfo* TInfo,
clang::Expr* BW,
bool Mutable,
clang::InClassInitStyle InitStyle)
Declared at: clang/include/clang/AST/Decl.h:2920
Parameters
- clang::Decl::Kind DK
- clang::DeclContext* DC
- clang::SourceLocation StartLoc
- clang::SourceLocation IdLoc
- clang::IdentifierInfo* Id
- clang::QualType T
- clang::TypeSourceInfo* TInfo
- clang::Expr* BW
- bool Mutable
- clang::InClassInitStyle InitStyle
¶static bool classof(const clang::Decl* D)
static bool classof(const clang::Decl* D)
Declared at: clang/include/clang/AST/Decl.h:3080
Parameters
- const clang::Decl* D
¶static bool classofKind(clang::Decl::Kind K)
static bool classofKind(clang::Decl::Kind K)
Declared at: clang/include/clang/AST/Decl.h:3081
Parameters
- clang::Decl::Kind K
¶clang::Expr* getBitWidth() const
clang::Expr* getBitWidth() const
Declared at: clang/include/clang/AST/Decl.h:2962
¶unsigned int getBitWidthValue(
const clang::ASTContext& Ctx) const
unsigned int getBitWidthValue(
const clang::ASTContext& Ctx) const
Declared at: clang/include/clang/AST/Decl.h:2971
Parameters
- const clang::ASTContext& Ctx
¶const clang::FieldDecl* getCanonicalDecl() const
const clang::FieldDecl* getCanonicalDecl() const
Declared at: clang/include/clang/AST/Decl.h:3077
¶clang::FieldDecl* getCanonicalDecl()
clang::FieldDecl* getCanonicalDecl()
Description
Retrieves the canonical declaration of this field.
Declared at: clang/include/clang/AST/Decl.h:3076
¶const clang::VariableArrayType*
getCapturedVLAType() const
const clang::VariableArrayType*
getCapturedVLAType() const
Description
Get the captured variable length array type.
Declared at: clang/include/clang/AST/Decl.h:3051
¶unsigned int getFieldIndex() const
unsigned int getFieldIndex() const
Description
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::getFieldOffset.
Declared at: clang/include/clang/AST/Decl.h:2945
¶clang::InClassInitStyle getInClassInitStyle()
const
clang::InClassInitStyle getInClassInitStyle()
const
Description
Get the kind of (C++11) default member initializer that this field has.
Declared at: clang/include/clang/AST/Decl.h:3006
¶clang::Expr* getInClassInitializer() const
clang::Expr* getInClassInitializer() const
Description
Get the C++11 default member initializer for this member, or null if one has not been set. If a valid declaration has a default member initializer, but this returns null, then we have not parsed and attached it yet.
Declared at: clang/include/clang/AST/Decl.h:3020
¶const clang::RecordDecl* getParent() const
const clang::RecordDecl* getParent() const
Description
Returns the parent of this field declaration, which is the struct in which this field is defined. Returns null if this is not a normal class/struct field declaration, e.g. ObjCAtDefsFieldDecl, ObjCIvarDecl.
Declared at: clang/include/clang/AST/Decl.h:3065
¶clang::RecordDecl* getParent()
clang::RecordDecl* getParent()
Declared at: clang/include/clang/AST/Decl.h:3069
¶clang::SourceRange getSourceRange() const
clang::SourceRange getSourceRange() const
Description
Source range that this declaration covers.
Declared at: clang/include/clang/AST/Decl.h:3073
¶bool hasCapturedVLAType() const
bool hasCapturedVLAType() const
Description
Determine whether this member captures the variable length array type.
Declared at: clang/include/clang/AST/Decl.h:3046
¶bool hasInClassInitializer() const
bool hasInClassInitializer() const
Description
Determine whether this member has a C++11 default member initializer.
Declared at: clang/include/clang/AST/Decl.h:3013
¶bool isAnonymousStructOrUnion() const
bool isAnonymousStructOrUnion() const
Description
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.
Declared at: clang/include/clang/AST/Decl.h:2960
¶bool isBitField() const
bool isBitField() const
Description
Determines whether this field is a bitfield.
Declared at: clang/include/clang/AST/Decl.h:2951
¶bool isMutable() const
bool isMutable() const
Description
Determines whether this field is mutable (C++ only).
Declared at: clang/include/clang/AST/Decl.h:2948
¶bool isUnnamedBitfield() const
bool isUnnamedBitfield() const
Description
Determines whether this is an unnamed bitfield.
Declared at: clang/include/clang/AST/Decl.h:2954
¶bool isZeroLengthBitField(
const clang::ASTContext& Ctx) const
bool isZeroLengthBitField(
const clang::ASTContext& Ctx) const
Description
Is this a zero-length bit-field? Such bit-fields aren't really bit-fields at all and instead act as a separator between contiguous runs of other bit-fields.
Declared at: clang/include/clang/AST/Decl.h:2998
Parameters
- const clang::ASTContext& Ctx
¶bool isZeroSize(
const clang::ASTContext& Ctx) const
bool isZeroSize(
const clang::ASTContext& Ctx) const
Description
Determine if this field is a subobject of zero size, that is, either a zero-length bit-field or a field of empty class type with the [[no_unique_address]] attribute.
Declared at: clang/include/clang/AST/Decl.h:3003
Parameters
- const clang::ASTContext& Ctx
¶void removeBitWidth()
void removeBitWidth()
Description
Remove the bit-field width from this member.
Declared at: clang/include/clang/AST/Decl.h:2989
¶void removeInClassInitializer()
void removeInClassInitializer()
Description
Remove the C++11 in-class initializer from this member.
Declared at: clang/include/clang/AST/Decl.h:3039
¶void setBitWidth(clang::Expr* Width)
void setBitWidth(clang::Expr* Width)
Description
Set the bit-field width for this member.
Declared at: clang/include/clang/AST/Decl.h:2975
Parameters
- clang::Expr* Width
¶void setCapturedVLAType(
const clang::VariableArrayType* VLAType)
void setCapturedVLAType(
const clang::VariableArrayType* VLAType)
Description
Set the captured variable length array type for this field.
Declared at: clang/include/clang/AST/Decl.h:3058
Parameters
- const clang::VariableArrayType* VLAType
¶void setInClassInitializer(clang::Expr* Init)
void setInClassInitializer(clang::Expr* Init)
Description
Set the C++11 in-class initializer for this member.
Declared at: clang/include/clang/AST/Decl.h:3030
Parameters
- clang::Expr* Init