clang: clang::CXXCtorInitializer Class Reference (original) (raw)
Represents a C++ base or member initializer. More...
#include "[clang/AST/DeclCXX.h](DeclCXX%5F8h%5Fsource.html)"
| 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:
class A { };
class B : public A {
float f;
public:
B(A& a) : A(a), f(3.14159) { }
};
Definition at line 2369 of file DeclCXX.h.
◆ CXXCtorInitializer() [2/4]
◆ CXXCtorInitializer() [3/4]
◆ CXXCtorInitializer() [4/4]
◆ getAnyMember()
| FieldDecl * clang::CXXCtorInitializer::getAnyMember ( ) const | inline |
|---|
Definition at line 2515 of file DeclCXX.h.
References clang::cast(), isIndirectMemberInitializer(), and isMemberInitializer().
Referenced by AddInitializerToDiag(), clang::Sema::DiagnoseImmediateEscalatingReason(), EmitLValueForAnyFieldInitialization(), emitLValueForAnyFieldInitialization(), EmitMemberInitializer(), emitMemberInitializer(), getSourceLocation(), getSourceRange(), and print_initializer().
◆ getBaseClass()
| const Type * CXXCtorInitializer::getBaseClass | ( | ) | const |
|---|
◆ getBaseClassLoc()
| 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 2889 of file DeclCXX.cpp.
References clang::cast(), and isBaseInitializer().
◆ getEllipsisLoc()
| SourceLocation clang::CXXCtorInitializer::getEllipsisLoc ( ) const | inline |
|---|
◆ getID()
| int64_t CXXCtorInitializer::getID | ( | const ASTContext & | Context | ) | const |
|---|
◆ getIndirectMember()
◆ getInit()
| Expr * clang::CXXCtorInitializer::getInit ( ) const | inline |
|---|
◆ getLParenLoc()
| SourceLocation clang::CXXCtorInitializer::getLParenLoc ( ) const | inline |
|---|
◆ getMember()
| FieldDecl * clang::CXXCtorInitializer::getMember ( ) const | inline |
|---|
◆ getMemberLocation()
| SourceLocation clang::CXXCtorInitializer::getMemberLocation ( ) const | inline |
|---|
◆ getRParenLoc()
| SourceLocation clang::CXXCtorInitializer::getRParenLoc ( ) const | inline |
|---|
◆ getSourceLocation()
◆ getSourceOrder()
| int clang::CXXCtorInitializer::getSourceOrder ( ) const | inline |
|---|
Return the source position of the initializer, counting from 0.
If the initializer was implicit, -1 is returned.
Definition at line 2545 of file DeclCXX.h.
◆ getSourceRange()
| SourceRange CXXCtorInitializer::getSourceRange | ( | ) | const |
|---|
◆ getTypeSourceInfo()
| TypeSourceInfo * clang::CXXCtorInitializer::getTypeSourceInfo ( ) const | inline |
|---|
◆ isAnyMemberInitializer()
| bool clang::CXXCtorInitializer::isAnyMemberInitializer ( ) const | inline |
|---|
◆ isBaseInitializer()
| bool clang::CXXCtorInitializer::isBaseInitializer ( ) const | inline |
|---|
◆ isBaseVirtual()
| bool clang::CXXCtorInitializer::isBaseVirtual ( ) const | inline |
|---|
◆ isDelegatingInitializer()
| bool clang::CXXCtorInitializer::isDelegatingInitializer ( ) const | inline |
|---|
◆ isInClassMemberInitializer()
| bool clang::CXXCtorInitializer::isInClassMemberInitializer ( ) const | 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 2463 of file DeclCXX.h.
Referenced by getSourceLocation(), and getSourceRange().
◆ isIndirectMemberInitializer()
| bool clang::CXXCtorInitializer::isIndirectMemberInitializer ( ) const | inline |
|---|
◆ isMemberInitializer()
| bool clang::CXXCtorInitializer::isMemberInitializer ( ) const | inline |
|---|
◆ isPackExpansion()
| bool clang::CXXCtorInitializer::isPackExpansion ( ) const | inline |
|---|
◆ isWritten()
| bool clang::CXXCtorInitializer::isWritten ( ) const | inline |
|---|
◆ setSourceOrder()
| void clang::CXXCtorInitializer::setSourceOrder ( int Pos) | 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 2556 of file DeclCXX.h.
Referenced by clang::ASTRecordReader::readCXXCtorInitializers().
The documentation for this class was generated from the following files:
- include/clang/AST/DeclCXX.h
- lib/AST/DeclCXX.cpp