clang  3.9.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
clang::FieldDecl Class Reference

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

#include <Decl.h>

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

Public Member Functions

unsigned getFieldIndex () const
 getFieldIndex - Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::getFieldOffset. More...
 
bool isMutable () const
 isMutable - Determines whether this field is mutable (C++ only). More...
 
bool isBitField () const
 Determines whether this field is a bitfield. More...
 
bool isUnnamedBitfield () const
 Determines whether this is an unnamed bitfield. More...
 
bool isAnonymousStructOrUnion () const
 isAnonymousStructOrUnion - Determines whether this field is a representative for an anonymous struct or union. More...
 
ExprgetBitWidth () const
 
unsigned getBitWidthValue (const ASTContext &Ctx) const
 
void setBitWidth (Expr *Width)
 setBitWidth - Set the bit-field width for this member. More...
 
void removeBitWidth ()
 removeBitWidth - Remove the bit-field width from this member. More...
 
InClassInitStyle getInClassInitStyle () const
 getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has. More...
 
bool hasInClassInitializer () const
 hasInClassInitializer - Determine whether this member has a C++11 in-class initializer. More...
 
ExprgetInClassInitializer () const
 getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not been set. More...
 
void setInClassInitializer (Expr *Init)
 setInClassInitializer - Set the C++11 in-class initializer for this member. More...
 
void removeInClassInitializer ()
 removeInClassInitializer - Remove the C++11 in-class initializer from this member. More...
 
bool hasCapturedVLAType () const
 Determine whether this member captures the variable length array type. More...
 
const VariableArrayTypegetCapturedVLAType () const
 Get the captured variable length array type. More...
 
void setCapturedVLAType (const VariableArrayType *VLAType)
 Set the captured variable length array type for this field. More...
 
const RecordDeclgetParent () const
 getParent - Returns the parent of this field declaration, which is the struct in which this method is defined. More...
 
RecordDeclgetParent ()
 
SourceRange getSourceRange () const override LLVM_READONLY
 
FieldDeclgetCanonicalDecl () override
 Retrieves the canonical declaration of this field. More...
 
const FieldDeclgetCanonicalDecl () const
 
- Public Member Functions inherited from clang::DeclaratorDecl
TypeSourceInfogetTypeSourceInfo () const
 
void setTypeSourceInfo (TypeSourceInfo *TI)
 
SourceLocation getInnerLocStart () const
 getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template declarations. More...
 
void setInnerLocStart (SourceLocation L)
 
SourceLocation getOuterLocStart () const
 getOuterLocStart - Return SourceLocation representing start of source range taking into account any outer template declarations. More...
 
SourceRange getSourceRange () const override LLVM_READONLY
 
SourceLocation getLocStart () const LLVM_READONLY
 
NestedNameSpecifiergetQualifier () const
 Retrieve the nested-name-specifier that qualifies the name of this declaration, if it was present in the source. More...
 
NestedNameSpecifierLoc getQualifierLoc () const
 Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this declaration, if it was present in the source. More...
 
void setQualifierInfo (NestedNameSpecifierLoc QualifierLoc)
 
unsigned getNumTemplateParameterLists () const
 
TemplateParameterListgetTemplateParameterList (unsigned index) const
 
void setTemplateParameterListsInfo (ASTContext &Context, ArrayRef< TemplateParameterList * > TPLists)
 
SourceLocation getTypeSpecStartLoc () const
 
- Public Member Functions inherited from clang::ValueDecl
QualType getType () const
 
void setType (QualType newType)
 
bool isWeak () const
 Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr. More...
 
- Public Member Functions inherited from clang::NamedDecl
IdentifierInfogetIdentifier () const
 getIdentifier - Get the identifier that names this declaration, if there is one. More...
 
StringRef getName () const
 getName - Get the name of identifier for this declaration as a StringRef. More...
 
std::string getNameAsString () const
 getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ constructor, Objective-C selector, etc). More...
 
void printName (raw_ostream &os) const
 
DeclarationName getDeclName () const
 getDeclName - Get the actual, stored name of the declaration, which may be a special name. More...
 
void setDeclName (DeclarationName N)
 Set the name of this declaration. More...
 
void printQualifiedName (raw_ostream &OS) const
 printQualifiedName - Returns human-readable qualified name for declaration, like A::B::i, for i being member of namespace A::B. More...
 
void printQualifiedName (raw_ostream &OS, const PrintingPolicy &Policy) const
 
std::string getQualifiedNameAsString () const
 
virtual void getNameForDiagnostic (raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
 getNameForDiagnostic - Appends a human-readable name for this declaration into the given stream. More...
 
bool declarationReplaces (NamedDecl *OldD, bool IsKnownNewer=true) const
 Determine whether this declaration, if known to be well-formed within its context, will replace the declaration OldD if introduced into scope. More...
 
bool hasLinkage () const
 Determine whether this declaration has linkage. More...
 
bool isHidden () const
 Determine whether this declaration is hidden from name lookup. More...
 
void setHidden (bool Hide)
 Set whether this declaration is hidden from name lookup. More...
 
bool isCXXClassMember () const
 Determine whether this declaration is a C++ class member. More...
 
bool isCXXInstanceMember () const
 Determine whether the given declaration is an instance member of a C++ class. More...
 
Linkage getLinkageInternal () const
 Determine what kind of linkage this entity has. More...
 
Linkage getFormalLinkage () const
 Get the linkage from a semantic point of view. More...
 
bool hasExternalFormalLinkage () const
 True if this decl has external linkage. More...
 
bool isExternallyVisible () const
 
Visibility getVisibility () const
 Determines the visibility of this entity. More...
 
LinkageInfo getLinkageAndVisibility () const
 Determines the linkage and visibility of this entity. More...
 
Optional< VisibilitygetExplicitVisibility (ExplicitVisibilityKind kind) const
 If visibility was explicitly specified for this declaration, return that visibility. More...
 
bool isLinkageValid () const
 True if the computed linkage is valid. More...
 
bool hasLinkageBeenComputed () const
 True if something has required us to compute the linkage of this declaration. More...
 
NamedDeclgetUnderlyingDecl ()
 Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl. More...
 
const NamedDeclgetUnderlyingDecl () const
 
NamedDeclgetMostRecentDecl ()
 
const NamedDeclgetMostRecentDecl () const
 
ObjCStringFormatFamily getObjCFStringFormattingFamily () const
 
- Public Member Functions inherited from clang::Mergeable< FieldDecl >
 Mergeable ()
 
FieldDeclgetFirstDecl ()
 Return the first declaration of this declaration or itself if this is the only declaration. More...
 
const FieldDeclgetFirstDecl () const
 Return the first declaration of this declaration or itself if this is the only declaration. More...
 
bool isFirstDecl () const
 Returns true if this is the first declaration. More...
 

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)
 
- Static Public Member Functions inherited from clang::DeclaratorDecl
static bool classof (const Decl *D)
 
static bool classofKind (Kind K)
 
- Static Public Member Functions inherited from clang::ValueDecl
static bool classof (const Decl *D)
 
static bool classofKind (Kind K)
 
- Static Public Member Functions inherited from clang::NamedDecl
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)
 
- Protected Member Functions inherited from clang::DeclaratorDecl
 DeclaratorDecl (Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T, TypeSourceInfo *TInfo, SourceLocation StartL)
 
- Protected Member Functions inherited from clang::ValueDecl
 ValueDecl (Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N, QualType T)
 
- Protected Member Functions inherited from clang::NamedDecl
 NamedDecl (Kind DK, DeclContext *DC, SourceLocation L, DeclarationName N)
 

Friends

class ASTDeclReader
 
class ASTDeclWriter
 

Additional Inherited Members

- Public Types inherited from clang::NamedDecl
enum  ExplicitVisibilityKind { VisibilityForType, VisibilityForValue }
 Kinds of explicit visibility. More...
 

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 2293 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 
)
inlineprotected

Definition at line 2334 of file Decl.h.

References clang::ICIS_NoInit.

Referenced by Create(), and CreateDeserialized().

Member Function Documentation

static bool clang::FieldDecl::classof ( const Decl D)
inlinestatic

Definition at line 2470 of file Decl.h.

References clang::ParmVarDecl::classofKind().

static bool clang::FieldDecl::classofKind ( Kind  K)
inlinestatic

Definition at line 2471 of file Decl.h.

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
FieldDecl * FieldDecl::CreateDeserialized ( ASTContext C,
unsigned  ID 
)
static

Definition at line 3452 of file Decl.cpp.

References FieldDecl(), clang::ICIS_NoInit, and ID.

Expr* clang::FieldDecl::getBitWidth ( ) const
inline
unsigned FieldDecl::getBitWidthValue ( const ASTContext Ctx) const
FieldDecl* clang::FieldDecl::getCanonicalDecl ( )
inlineoverride
const FieldDecl* clang::FieldDecl::getCanonicalDecl ( ) const
inline

Definition at line 2467 of file Decl.h.

References clang::Redeclarable< VarDecl >::getFirstDecl().

const VariableArrayType* clang::FieldDecl::getCapturedVLAType ( ) const
inline

Get the captured variable length array type.

Definition at line 2445 of file Decl.h.

Referenced by clang::ento::ExprEngine::VisitLambdaExpr().

unsigned FieldDecl::getFieldIndex ( ) const
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 2416 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 2400 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
RecordDecl* clang::FieldDecl::getParent ( )
inline

Definition at line 2459 of file Decl.h.

SourceRange FieldDecl::getSourceRange ( ) const
override
bool clang::FieldDecl::hasCapturedVLAType ( ) const
inline

Determine whether this member captures the variable length array type.

Definition at line 2440 of file Decl.h.

Referenced by clang::ento::ExprEngine::VisitLambdaExpr().

bool clang::FieldDecl::hasInClassInitializer ( ) const
inline

hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.

Definition at line 2408 of file Decl.h.

References clang::ICIS_NoInit.

Referenced by clang::Sema::BuildCXXDefaultInitExpr(), CollectFieldInitializer(), clang::Sema::InstantiateInClassInitializer(), and clang::ASTDeclWriter::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 3458 of file Decl.cpp.

References clang::NamedDecl::getDeclName(), and clang::ValueDecl::getType().

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 2358 of file Decl.h.

Referenced by BuildFieldReferenceExpr(), clang::ASTDeclWriter::VisitFieldDecl(), and clang::ASTNodeImporter::VisitFieldDecl().

bool clang::FieldDecl::isUnnamedBitfield ( ) const
inline
void clang::FieldDecl::removeBitWidth ( )
inline

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

Definition at line 2393 of file Decl.h.

void clang::FieldDecl::removeInClassInitializer ( )
inline

removeInClassInitializer - Remove the C++11 in-class initializer from this member.

Definition at line 2433 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 2384 of file Decl.h.

void FieldDecl::setCapturedVLAType ( const VariableArrayType VLAType)

Set the captured variable length array type for this field.

Definition at line 3509 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 2424 of file Decl.h.

Referenced by clang::Sema::ActOnFinishCXXInClassMemberInitializer(), and clang::ASTNodeImporter::VisitFieldDecl().

Friends And Related Function Documentation

friend class ASTDeclReader
friend

Definition at line 2473 of file Decl.h.

friend class ASTDeclWriter
friend

Definition at line 2474 of file Decl.h.


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