clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::CXXConstructorDecl Class Reference

Represents a C++ constructor within a class. More...

#include <DeclCXX.h>

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

List of all members.

Public Types

typedef CXXCtorInitializer ** init_iterator
 Iterates through the member/base initializer list.
typedef CXXCtorInitializer *const * init_const_iterator
 Iterates through the member/base initializer list.
typedef llvm::iterator_range
< init_iterator
init_range
typedef llvm::iterator_range
< init_const_iterator
init_const_range
typedef std::reverse_iterator
< init_iterator
init_reverse_iterator
typedef std::reverse_iterator
< init_const_iterator
init_const_reverse_iterator

Public Member Functions

bool isExplicitSpecified () const
 Determine whether this constructor declaration has the explicit keyword specified.
bool isExplicit () const
 Determine whether this constructor was marked "explicit" or not.
init_range inits ()
init_const_range inits () const
init_iterator init_begin ()
 Retrieve an iterator to the first initializer.
init_const_iterator init_begin () const
 Retrieve an iterator to the first initializer.
init_iterator init_end ()
 Retrieve an iterator past the last initializer.
init_const_iterator init_end () const
 Retrieve an iterator past the last initializer.
init_reverse_iterator init_rbegin ()
init_const_reverse_iterator init_rbegin () const
init_reverse_iterator init_rend ()
init_const_reverse_iterator init_rend () const
unsigned getNumCtorInitializers () const
 Determine the number of arguments used to initialize the member or base.
void setNumCtorInitializers (unsigned numCtorInitializers)
void setCtorInitializers (CXXCtorInitializer **initializers)
bool isDelegatingConstructor () const
 Determine whether this constructor is a delegating constructor.
CXXConstructorDeclgetTargetConstructor () const
 When this constructor delegates to another, retrieve the target.
bool isDefaultConstructor () const
bool isCopyConstructor (unsigned &TypeQuals) const
 Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the class.
bool isCopyConstructor () const
bool isMoveConstructor (unsigned &TypeQuals) const
 Determine whether this constructor is a move constructor (C++0x [class.copy]p3), which can be used to move values of the class.
bool isMoveConstructor () const
 Determine whether this constructor is a move constructor (C++0x [class.copy]p3), which can be used to move values of the class.
bool isCopyOrMoveConstructor (unsigned &TypeQuals) const
 Determine whether this is a copy or move constructor.
bool isCopyOrMoveConstructor () const
 Determine whether this a copy or move constructor.
bool isConvertingConstructor (bool AllowExplicit) const
bool isSpecializationCopyingObject () const
 Determine whether this is a member template specialization that would copy the object to itself. Such constructors are never used to copy an object.
const CXXConstructorDeclgetInheritedConstructor () const
 Get the constructor that this inheriting constructor is based on.
void setInheritedConstructor (const CXXConstructorDecl *BaseCtor)
 Set the constructor that this inheriting constructor is based on.
const CXXConstructorDeclgetCanonicalDecl () const override
CXXConstructorDeclgetCanonicalDecl () override
 Retrieves the "canonical" declaration of the given declaration.

Static Public Member Functions

static CXXConstructorDeclCreateDeserialized (ASTContext &C, unsigned ID)
static CXXConstructorDeclCreate (ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isExplicit, bool isInline, bool isImplicitlyDeclared, bool isConstexpr)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Friends

class ASTDeclReader
class ASTDeclWriter

Detailed Description

Represents a C++ constructor within a class.

For example:

 class X {
 public:
   explicit X(int); // represented by a CXXConstructorDecl.
 };

Definition at line 2140 of file DeclCXX.h.


Member Typedef Documentation

Iterates through the member/base initializer list.

Definition at line 2188 of file DeclCXX.h.

Definition at line 2191 of file DeclCXX.h.

Definition at line 2214 of file DeclCXX.h.

Iterates through the member/base initializer list.

Definition at line 2185 of file DeclCXX.h.

Definition at line 2190 of file DeclCXX.h.

Definition at line 2212 of file DeclCXX.h.


Member Function Documentation

static bool clang::CXXConstructorDecl::classof ( const Decl D) [inline, static]

Reimplemented from clang::CXXMethodDecl.

Definition at line 2331 of file DeclCXX.h.

References classofKind(), and clang::Decl::getKind().

static bool clang::CXXConstructorDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::CXXMethodDecl.

Definition at line 2332 of file DeclCXX.h.

Referenced by classof().

CXXConstructorDecl * CXXConstructorDecl::Create ( ASTContext C,
CXXRecordDecl RD,
SourceLocation  StartLoc,
const DeclarationNameInfo NameInfo,
QualType  T,
TypeSourceInfo TInfo,
bool  isExplicit,
bool  isInline,
bool  isImplicitlyDeclared,
bool  isConstexpr 
) [static]

Reimplemented from clang::CXXMethodDecl.

Definition at line 1722 of file DeclCXX.cpp.

References AttributeLangSupport::C.

const CXXConstructorDecl* clang::CXXConstructorDecl::getCanonicalDecl ( ) const [inline, override, virtual]

Reimplemented from clang::CXXMethodDecl.

Definition at line 2323 of file DeclCXX.h.

Referenced by DelegatingCycleHelper(), getCanonicalDecl(), and TryValueInitialization().

Retrieves the "canonical" declaration of the given declaration.

Reimplemented from clang::CXXMethodDecl.

Definition at line 2326 of file DeclCXX.h.

References getCanonicalDecl().

Determine the number of arguments used to initialize the member or base.

Definition at line 2232 of file DeclCXX.h.

Referenced by isDelegatingConstructor().

When this constructor delegates to another, retrieve the target.

Definition at line 1743 of file DeclCXX.cpp.

References clang::Expr::IgnoreImplicit(), init_begin(), and isDelegatingConstructor().

Referenced by DelegatingCycleHelper().

Retrieve an iterator to the first initializer.

Definition at line 2201 of file DeclCXX.h.

Retrieve an iterator past the last initializer.

Definition at line 2204 of file DeclCXX.h.

Referenced by clang::CodeGen::CodeGenFunction::EmitCtorPrologue(), init_rbegin(), and inits().

Retrieve an iterator past the last initializer.

Definition at line 2208 of file DeclCXX.h.

Definition at line 2216 of file DeclCXX.h.

References init_end().

Definition at line 2219 of file DeclCXX.h.

References init_end().

Definition at line 2223 of file DeclCXX.h.

References init_begin().

Definition at line 2226 of file DeclCXX.h.

References init_begin().

Definition at line 2193 of file DeclCXX.h.

References init_begin(), and init_end().

Referenced by HandleConstructorCall(), and clang::Sema::InstantiateMemInitializers().

Definition at line 2194 of file DeclCXX.h.

References init_begin(), and init_end().

Whether this constructor is a converting constructor (C++ [class.conv.ctor]), which can be used for user-defined conversions.

Definition at line 1813 of file DeclCXX.cpp.

References clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), clang::ParmVarDecl::hasDefaultArg(), isExplicit(), clang::ParmVarDecl::isParameterPack(), and clang::FunctionDecl::isVariadic().

Referenced by LookupCopyAndMoveConstructors().

Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the class.

TypeQuals will be set to the qualifiers on the argument type. For example, TypeQuals would be set to Qualifiers::Const for the following copy constructor:

 class X {
 public:
   X(const X&);
 };

Definition at line 1761 of file DeclCXX.cpp.

References clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), isCopyOrMoveConstructor(), and clang::Type::isLValueReferenceType().

Referenced by clang::Sema::DefineImplicitCopyConstructor(), EvaluateUnaryTypeTrait(), HandleConstructorCall(), clang::consumed::ConsumedStmtVisitor::VisitCXXConstructExpr(), and clang::threadSafety::BuildLockset::VisitCXXConstructExpr().

Whether this constructor is a copy constructor (C++ [class.copy]p2, which can be used to copy the class.

Definition at line 2276 of file DeclCXX.h.

Determine whether this a copy or move constructor.

Definition at line 2302 of file DeclCXX.h.

Referenced by isCopyConstructor(), and isMoveConstructor().

Determine whether this constructor was marked "explicit" or not.

Definition at line 2180 of file DeclCXX.h.

References clang::Redeclarable< FunctionDecl >::getFirstDecl(), and isExplicitSpecified().

Referenced by isConvertingConstructor(), ResolveConstructorOverload(), and TryConstructorInitialization().

Determine whether this constructor declaration has the explicit keyword specified.

Definition at line 2177 of file DeclCXX.h.

Referenced by isExplicit().

Determine whether this constructor is a move constructor (C++0x [class.copy]p3), which can be used to move values of the class.

Parameters:
TypeQualsIf this constructor is a move constructor, will be set to the type qualifiers on the referent of the first parameter's type.

Definition at line 1766 of file DeclCXX.cpp.

References clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), isCopyOrMoveConstructor(), and clang::Type::isRValueReferenceType().

Referenced by clang::Sema::AddOverloadCandidate(), clang::Sema::DefineImplicitMoveConstructor(), HandleConstructorCall(), and clang::consumed::ConsumedStmtVisitor::VisitCXXConstructExpr().

Determine whether this constructor is a move constructor (C++0x [class.copy]p3), which can be used to move values of the class.

Definition at line 2290 of file DeclCXX.h.

Set the constructor that this inheriting constructor is based on.

Definition at line 1862 of file DeclCXX.cpp.

References clang::ASTContext::addOverriddenMethod(), and clang::Decl::getASTContext().

Referenced by clang::ASTDeclReader::VisitCXXConstructorDecl().

void clang::CXXConstructorDecl::setNumCtorInitializers ( unsigned  numCtorInitializers) [inline]

Friends And Related Function Documentation

friend class ASTDeclReader [friend]

Reimplemented from clang::FunctionDecl.

Definition at line 2334 of file DeclCXX.h.

friend class ASTDeclWriter [friend]

Reimplemented from clang::FunctionDecl.

Definition at line 2335 of file DeclCXX.h.


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