clang
3.9.0
|
Represents a C++ base or member initializer. More...
#include <DeclCXX.h>
Public Member Functions | |
CXXCtorInitializer (ASTContext &Context, TypeSourceInfo *TInfo, bool IsVirtual, SourceLocation L, Expr *Init, SourceLocation R, SourceLocation EllipsisLoc) | |
Creates a new base-class initializer. More... | |
CXXCtorInitializer (ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R) | |
Creates a new member initializer. More... | |
CXXCtorInitializer (ASTContext &Context, IndirectFieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R) | |
Creates a new anonymous field initializer. More... | |
CXXCtorInitializer (ASTContext &Context, TypeSourceInfo *TInfo, SourceLocation L, Expr *Init, SourceLocation R) | |
Creates a new delegating initializer. More... | |
bool | isBaseInitializer () const |
Determine whether this initializer is initializing a base class. More... | |
bool | isMemberInitializer () const |
Determine whether this initializer is initializing a non-static data member. More... | |
bool | isAnyMemberInitializer () const |
bool | isIndirectMemberInitializer () const |
bool | isInClassMemberInitializer () const |
Determine whether this initializer is an implicit initializer generated for a field with an initializer defined on the member declaration. More... | |
bool | isDelegatingInitializer () const |
Determine whether this initializer is creating a delegating constructor. More... | |
bool | isPackExpansion () const |
Determine whether this initializer is a pack expansion. More... | |
SourceLocation | getEllipsisLoc () const |
TypeLoc | getBaseClassLoc () const |
If this is a base class initializer, returns the type of the base class with location information. More... | |
const Type * | getBaseClass () const |
If this is a base class initializer, returns the type of the base class. More... | |
bool | isBaseVirtual () const |
Returns whether the base is virtual or not. More... | |
TypeSourceInfo * | getTypeSourceInfo () const |
Returns the declarator information for a base class or delegating initializer. More... | |
FieldDecl * | getMember () const |
If this is a member initializer, returns the declaration of the non-static data member being initialized. More... | |
FieldDecl * | getAnyMember () const |
IndirectFieldDecl * | getIndirectMember () const |
SourceLocation | getMemberLocation () const |
SourceLocation | getSourceLocation () const |
Determine the source location of the initializer. More... | |
SourceRange | getSourceRange () const LLVM_READONLY |
Determine the source range covering the entire initializer. More... | |
bool | isWritten () const |
Determine whether this initializer is explicitly written in the source code. More... | |
int | getSourceOrder () const |
Return the source position of the initializer, counting from 0. More... | |
void | setSourceOrder (int pos) |
Set the source order of this initializer. More... | |
SourceLocation | getLParenLoc () const |
SourceLocation | getRParenLoc () const |
unsigned | getNumArrayIndices () const |
Determine the number of implicit array indices used while described an array member initialization. More... | |
VarDecl * | getArrayIndex (unsigned I) |
Retrieve a particular array index variable used to describe an array member initialization. More... | |
const VarDecl * | getArrayIndex (unsigned I) const |
void | setArrayIndex (unsigned I, VarDecl *Index) |
ArrayRef< VarDecl * > | getArrayIndices () |
Expr * | getInit () const |
Get the initializer. More... | |
Static Public Member Functions | |
static CXXCtorInitializer * | Create (ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R, VarDecl **Indices, unsigned NumIndices) |
Creates a new member initializer that optionally contains array indices used to describe an elementwise initialization. More... | |
Public Attributes | |
friend | TrailingObjects |
Represents a C++ base or member initializer.
This is part of a constructor initializer that initializes one non-static member variable or one base class. For example, in the following, both 'A(a)' and 'f(3.14159)' are member initializers:
|
explicit |
Creates a new base-class initializer.
Definition at line 1710 of file DeclCXX.cpp.
|
explicit |
Creates a new member initializer.
Definition at line 1721 of file DeclCXX.cpp.
|
explicit |
Creates a new anonymous field initializer.
Definition at line 1732 of file DeclCXX.cpp.
|
explicit |
Creates a new delegating initializer.
Definition at line 1743 of file DeclCXX.cpp.
|
static |
Creates a new member initializer that optionally contains array indices used to describe an elementwise initialization.
Definition at line 1768 of file DeclCXX.cpp.
References clang::ASTContext::Allocate().
Referenced by BuildImplicitMemberInitializer(), clang::ASTImporter::Import(), and clang::ASTReader::ReadCXXCtorInitializers().
|
inline |
Definition at line 2074 of file DeclCXX.h.
References clang::IndirectFieldDecl::getAnonField(), isIndirectMemberInitializer(), and isMemberInitializer().
Referenced by DiagnoseBaseOrMemInitializerOrder(), EmitLValueForAnyFieldInitialization(), EmitMemberInitializer(), GetKeyForMember(), llvm::DOTGraphTraits< ExplodedNode * >::getNodeLabel(), getSourceLocation(), getSourceRange(), print_elem(), and clang::Sema::SetCtorInitializers().
Retrieve a particular array index variable used to describe an array member initialization.
Definition at line 2137 of file DeclCXX.h.
References getNumArrayIndices().
Referenced by clang::ASTImporter::Import().
Definition at line 2141 of file DeclCXX.h.
References getNumArrayIndices().
Definition at line 2149 of file DeclCXX.h.
References getNumArrayIndices().
Referenced by EmitMemberInitializer(), and clang::RecursiveASTVisitor< Derived >::TraverseConstructorInitializer().
const Type * CXXCtorInitializer::getBaseClass | ( | ) | const |
If this is a base class initializer, returns the type of the base class.
Otherwise, returns null.
Definition at line 1788 of file DeclCXX.cpp.
References isBaseInitializer().
Referenced by EmitBaseInitializer(), GetKeyForMember(), isInitializerOfDynamicClass(), print_elem(), and clang::Sema::SetCtorInitializers().
TypeLoc CXXCtorInitializer::getBaseClassLoc | ( | ) | const |
If this is a base class initializer, returns the type of the base class with location information.
Otherwise, returns an NULL type location.
Definition at line 1781 of file DeclCXX.cpp.
References isBaseInitializer().
|
inline |
Definition at line 2040 of file DeclCXX.h.
References isPackExpansion().
Referenced by clang::ASTImporter::Import().
|
inline |
Definition at line 2082 of file DeclCXX.h.
References isIndirectMemberInitializer().
Referenced by EmitLValueForAnyFieldInitialization(), clang::ASTImporter::Import(), clang::ento::ExprEngine::ProcessInitializer(), and clang::Sema::SetCtorInitializers().
|
inline |
Get the initializer.
Definition at line 2155 of file DeclCXX.h.
Referenced by AllTrivialInitializers(), EmitBaseInitializer(), clang::CodeGen::CodeGenFunction::EmitDelegatingCXXConstructorCall(), EmitMemberInitializer(), getLocationForCaller(), clang::ASTImporter::Import(), print_elem(), clang::ento::ExprEngine::ProcessInitializer(), and clang::RecursiveASTVisitor< Derived >::TraverseConstructorInitializer().
|
inline |
Definition at line 2126 of file DeclCXX.h.
Referenced by clang::ASTImporter::Import().
|
inline |
If this is a member initializer, returns the declaration of the non-static data member being initialized.
Otherwise, returns null.
Definition at line 2069 of file DeclCXX.h.
References isMemberInitializer().
Referenced by clang::ASTImporter::Import(), clang::ento::ExprEngine::ProcessInitializer(), and clang::Sema::SetCtorInitializers().
|
inline |
Definition at line 2088 of file DeclCXX.h.
Referenced by getSourceLocation(), and clang::ASTImporter::Import().
|
inline |
Determine the number of implicit array indices used while described an array member initialization.
Definition at line 2131 of file DeclCXX.h.
Referenced by EmitMemberInitializer(), getArrayIndex(), getArrayIndices(), clang::ASTImporter::Import(), clang::ento::ExprEngine::ProcessInitializer(), and setArrayIndex().
|
inline |
Definition at line 2127 of file DeclCXX.h.
Referenced by getSourceRange(), and clang::ASTImporter::Import().
SourceLocation CXXCtorInitializer::getSourceLocation | ( | ) | const |
Determine the source location of the initializer.
Definition at line 1795 of file DeclCXX.cpp.
References getAnyMember(), getMemberLocation(), isAnyMemberInitializer(), and isInClassMemberInitializer().
Referenced by clang::Sema::ActOnMemInitializers(), DiagnoseBaseOrMemInitializerOrder(), EmitMemberInitializer(), getSourceRange(), clang::ento::ExprEngine::ProcessInitializer(), and clang::Sema::SetDelegatingInitializer().
|
inline |
SourceRange CXXCtorInitializer::getSourceRange | ( | ) | const |
Determine the source range covering the entire initializer.
Definition at line 1808 of file DeclCXX.cpp.
References getAnyMember(), clang::FieldDecl::getInClassInitializer(), getRParenLoc(), getSourceLocation(), I, and isInClassMemberInitializer().
Referenced by clang::Sema::ActOnMemInitializers().
|
inline |
Returns the declarator information for a base class or delegating initializer.
Definition at line 2063 of file DeclCXX.h.
Referenced by DiagnoseBaseOrMemInitializerOrder(), llvm::DOTGraphTraits< ExplodedNode * >::getNodeLabel(), clang::ASTImporter::Import(), print_elem(), and clang::RecursiveASTVisitor< Derived >::TraverseConstructorInitializer().
|
inline |
Definition at line 2010 of file DeclCXX.h.
References isIndirectMemberInitializer(), and isMemberInitializer().
Referenced by clang::Sema::ActOnMemInitializers(), DiagnoseBaseOrMemInitializerOrder(), clang::CodeGen::CodeGenFunction::EmitCtorPrologue(), EmitMemberInitializer(), GetKeyForMember(), getSourceLocation(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Determine whether this initializer is initializing a base class.
Definition at line 2002 of file DeclCXX.h.
Referenced by clang::Sema::ActOnMemInitializers(), EmitBaseInitializer(), clang::CodeGen::CodeGenFunction::EmitCtorPrologue(), getBaseClass(), getBaseClassLoc(), clang::ASTImporter::Import(), isBaseVirtual(), isPackExpansion(), print_elem(), clang::ento::ExprEngine::ProcessInitializer(), and clang::Sema::SetCtorInitializers().
|
inline |
Returns whether the base is virtual or not.
Definition at line 2055 of file DeclCXX.h.
References isBaseInitializer().
Referenced by EmitBaseInitializer(), and clang::ASTImporter::Import().
|
inline |
Determine whether this initializer is creating a delegating constructor.
Definition at line 2030 of file DeclCXX.h.
Referenced by clang::Sema::ActOnMemInitializers(), clang::ASTImporter::Import(), clang::CXXConstructorDecl::isDelegatingConstructor(), print_elem(), clang::ento::ExprEngine::ProcessInitializer(), and clang::Sema::SetDelegatingInitializer().
|
inline |
Determine whether this initializer is an implicit initializer generated for a field with an initializer defined on the member declaration.
In-class member initializers (also known as "non-static data member initializations", NSDMIs) were introduced in C++11.
Definition at line 2024 of file DeclCXX.h.
Referenced by getSourceLocation(), and getSourceRange().
|
inline |
Definition at line 2014 of file DeclCXX.h.
Referenced by EmitLValueForAnyFieldInitialization(), getAnyMember(), getIndirectMember(), clang::ASTImporter::Import(), isAnyMemberInitializer(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Determine whether this initializer is initializing a non-static data member.
Definition at line 2008 of file DeclCXX.h.
Referenced by getAnyMember(), getMember(), clang::ASTImporter::Import(), and isAnyMemberInitializer().
|
inline |
Determine whether this initializer is a pack expansion.
Definition at line 2035 of file DeclCXX.h.
References isBaseInitializer(), and clang::SourceLocation::isValid().
Referenced by getEllipsisLoc(), and clang::ASTImporter::Import().
|
inline |
Determine whether this initializer is explicitly written in the source code.
Definition at line 2100 of file DeclCXX.h.
Referenced by clang::RecursiveASTVisitor< Derived >::TraverseConstructorInitializer().
Definition at line 2145 of file DeclCXX.h.
References getNumArrayIndices().
|
inline |
Set the source order of this initializer.
This can only be called once for each initializer; it cannot be called on an initializer having a positive number of (implicit) array indices.
This assumes that the initializer was written in the source code, and ensures that isWritten() returns true.
Definition at line 2115 of file DeclCXX.h.
Referenced by clang::Sema::ActOnMemInitializers(), and clang::ASTReader::ReadCXXCtorInitializers().