clang 17.0.0git
|
Represents a C++ base or member initializer. More...
#include "clang/AST/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. | |
CXXCtorInitializer (ASTContext &Context, FieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R) | |
Creates a new member initializer. | |
CXXCtorInitializer (ASTContext &Context, IndirectFieldDecl *Member, SourceLocation MemberLoc, SourceLocation L, Expr *Init, SourceLocation R) | |
Creates a new anonymous field initializer. | |
CXXCtorInitializer (ASTContext &Context, TypeSourceInfo *TInfo, SourceLocation L, Expr *Init, SourceLocation R) | |
Creates a new delegating initializer. | |
int64_t | getID (const ASTContext &Context) const |
bool | isBaseInitializer () const |
Determine whether this initializer is initializing a base class. | |
bool | isMemberInitializer () const |
Determine whether this initializer is initializing a non-static data member. | |
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. | |
bool | isDelegatingInitializer () const |
Determine whether this initializer is creating a delegating constructor. | |
bool | isPackExpansion () const |
Determine whether this initializer is a pack expansion. | |
SourceLocation | getEllipsisLoc () const |
TypeLoc | getBaseClassLoc () const |
If this is a base class initializer, returns the type of the base class with location information. | |
const Type * | getBaseClass () const |
If this is a base class initializer, returns the type of the base class. | |
bool | isBaseVirtual () const |
Returns whether the base is virtual or not. | |
TypeSourceInfo * | getTypeSourceInfo () const |
Returns the declarator information for a base class or delegating initializer. | |
FieldDecl * | getMember () const |
If this is a member initializer, returns the declaration of the non-static data member being initialized. | |
FieldDecl * | getAnyMember () const |
IndirectFieldDecl * | getIndirectMember () const |
SourceLocation | getMemberLocation () const |
SourceLocation | getSourceLocation () const |
Determine the source location of the initializer. | |
SourceRange | getSourceRange () const LLVM_READONLY |
Determine the source range covering the entire initializer. | |
bool | isWritten () const |
Determine whether this initializer is explicitly written in the source code. | |
int | getSourceOrder () const |
Return the source position of the initializer, counting from 0. | |
void | setSourceOrder (int Pos) |
Set the source order of this initializer. | |
SourceLocation | getLParenLoc () const |
SourceLocation | getRParenLoc () const |
Expr * | getInit () const |
Get the initializer. | |
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 2543 of file DeclCXX.cpp.
|
explicit |
Creates a new member initializer.
Definition at line 2552 of file DeclCXX.cpp.
|
explicit |
Creates a new anonymous field initializer.
Definition at line 2560 of file DeclCXX.cpp.
|
explicit |
Creates a new delegating initializer.
Definition at line 2569 of file DeclCXX.cpp.
|
inline |
Definition at line 2402 of file DeclCXX.h.
References clang::IndirectFieldDecl::getAnonField(), isIndirectMemberInitializer(), and isMemberInitializer().
Referenced by EmitLValueForAnyFieldInitialization(), EmitMemberInitializer(), getSourceLocation(), getSourceRange(), and print_initializer().
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 2588 of file DeclCXX.cpp.
References isBaseInitializer().
Referenced by EmitBaseInitializer(), isInitializerOfDynamicClass(), and print_initializer().
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 2581 of file DeclCXX.cpp.
References isBaseInitializer().
|
inline |
Definition at line 2366 of file DeclCXX.h.
References isPackExpansion().
Referenced by clang::ASTImporter::Import().
int64_t CXXCtorInitializer::getID | ( | const ASTContext & | Context | ) | const |
Definition at line 2576 of file DeclCXX.cpp.
References clang::ASTContext::getAllocator().
|
inline |
Definition at line 2410 of file DeclCXX.h.
References isIndirectMemberInitializer().
Referenced by EmitLValueForAnyFieldInitialization(), clang::ASTImporter::Import(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Get the initializer.
Definition at line 2458 of file DeclCXX.h.
Referenced by AllTrivialInitializers(), EmitBaseInitializer(), EmitMemberInitializer(), clang::ConstructorInitializerConstructionContext::getArrayInitLoop(), clang::ASTImporter::Import(), print_initializer(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Definition at line 2454 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 2396 of file DeclCXX.h.
References isMemberInitializer().
Referenced by clang::ASTImporter::Import(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Definition at line 2416 of file DeclCXX.h.
Referenced by getSourceLocation(), and clang::ASTImporter::Import().
|
inline |
Definition at line 2455 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 2595 of file DeclCXX.cpp.
References getAnyMember(), clang::Decl::getLocation(), getMemberLocation(), isAnyMemberInitializer(), and isInClassMemberInitializer().
Referenced by DiagnoseBaseOrMemInitializerOrder(), EmitMemberInitializer(), getSourceRange(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
SourceRange CXXCtorInitializer::getSourceRange | ( | ) | const |
Determine the source range covering the entire initializer.
Definition at line 2608 of file DeclCXX.cpp.
References getAnyMember(), clang::FieldDecl::getInClassInitializer(), getRParenLoc(), getSourceLocation(), and isInClassMemberInitializer().
Referenced by DiagnoseBaseOrMemInitializerOrder().
|
inline |
Returns the declarator information for a base class or delegating initializer.
Definition at line 2390 of file DeclCXX.h.
Referenced by clang::ASTImporter::Import(), and print_initializer().
|
inline |
Definition at line 2336 of file DeclCXX.h.
References isIndirectMemberInitializer(), and isMemberInitializer().
Referenced by EmitMemberInitializer(), getSourceLocation(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Determine whether this initializer is initializing a base class.
Definition at line 2328 of file DeclCXX.h.
Referenced by EmitBaseInitializer(), getBaseClass(), getBaseClassLoc(), clang::ASTImporter::Import(), isBaseVirtual(), isPackExpansion(), print_initializer(), and clang::ento::ExprEngine::ProcessInitializer().
|
inline |
Returns whether the base is virtual or not.
Definition at line 2382 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 2356 of file DeclCXX.h.
Referenced by clang::ASTImporter::Import(), clang::CXXConstructorDecl::isDelegatingConstructor(), print_initializer(), and clang::ento::ExprEngine::ProcessInitializer().
|
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 2350 of file DeclCXX.h.
Referenced by getSourceLocation(), and getSourceRange().
|
inline |
Definition at line 2340 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 2334 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 2361 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 2428 of file DeclCXX.h.
Referenced by clang::diff::isSpecializedNodeExcluded().
|
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 2443 of file DeclCXX.h.
Referenced by clang::ASTRecordReader::readCXXCtorInitializers().