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

Inherited from DeclaratorDecl:

Inherited from ValueDecl:

Inherited from NamedDecl:

Inherited from Decl:

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)

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)

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)

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)

Declared at: clang/include/clang/AST/Decl.h:3080

Parameters

const clang::Decl* D

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

Declared at: clang/include/clang/AST/Decl.h:2962

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

Declared at: clang/include/clang/AST/Decl.h:3077

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

Description

Get the captured variable length array type.

Declared at: clang/include/clang/AST/Decl.h:3051

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

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

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

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

Declared at: clang/include/clang/AST/Decl.h:3069

clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/Decl.h:3073

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

Description

Determine whether this member has a C++11 default member initializer.

Declared at: clang/include/clang/AST/Decl.h:3013

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

Description

Determines whether this field is a bitfield.

Declared at: clang/include/clang/AST/Decl.h:2951

bool isMutable() const

Description

Determines whether this field is mutable (C++ only).

Declared at: clang/include/clang/AST/Decl.h:2948

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

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

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

Description

Remove the bit-field width from this member.

Declared at: clang/include/clang/AST/Decl.h:2989

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)

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)

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)

Description

Set the C++11 in-class initializer for this member.

Declared at: clang/include/clang/AST/Decl.h:3030

Parameters

clang::Expr* Init