clang API Documentation

Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
clang::FieldDecl Class Reference

#include <Decl.h>

Inheritance diagram for clang::FieldDecl:
Inheritance graph
[legend]
Collaboration diagram for clang::FieldDecl:
Collaboration graph
[legend]

List of all members.

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
ExprgetBitWidth () 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
ExprgetInClassInitializer () const
void setInClassInitializer (Expr *Init)
void removeInClassInitializer ()
bool hasCapturedVLAType () const
 Determine whether this member captures the variable length array type.
const VariableArrayTypegetCapturedVLAType () const
 Get the captured variable length array type.
void setCapturedVLAType (const VariableArrayType *VLAType)
 Set the captured variable length array type for this field.
const RecordDeclgetParent () const
RecordDeclgetParent ()
SourceRange getSourceRange () const override LLVM_READONLY
 Source range that this declaration covers.
FieldDeclgetCanonicalDecl () override
 Retrieves the canonical declaration of this field.
const FieldDeclgetCanonicalDecl () const

Static Public Member Functions

static FieldDeclCreate (const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
static FieldDeclCreateDeserialized (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

Detailed Description

FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struct/union/class.

Definition at line 2165 of file Decl.h.


Constructor & Destructor Documentation

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


Member Function Documentation

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]

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]
FieldDecl* clang::FieldDecl::getCanonicalDecl ( ) [inline, override, virtual]
const FieldDecl* clang::FieldDecl::getCanonicalDecl ( ) const [inline]

Reimplemented from clang::Decl.

Definition at line 2339 of file Decl.h.

Get the captured variable length array type.

Definition at line 2317 of file Decl.h.

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

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

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]

Definition at line 2331 of file Decl.h.

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

Determine whether this member captures the variable length array type.

Definition at line 2312 of file Decl.h.

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

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

removeBitWidth - Remove the bit-field width from this member.

Definition at line 2265 of file Decl.h.

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]

setBitWidth - Set the bit-field width for this member.

Definition at line 2256 of file Decl.h.

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


Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::DeclaratorDecl.

Definition at line 2345 of file Decl.h.

friend class ASTDeclWriter [friend]

Reimplemented from clang::DeclaratorDecl.

Definition at line 2346 of file Decl.h.


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