protected:
CXXConstructExpr(const ASTContext &C, StmtClass SC, QualType T,
SourceLocation Loc,
- NamedDecl *Found, CXXConstructorDecl *Ctor,
+ CXXConstructorDecl *Ctor,
bool Elidable,
ArrayRef<Expr *> Args,
bool HadMultipleCandidates,
static CXXConstructExpr *Create(const ASTContext &C, QualType T,
SourceLocation Loc,
- NamedDecl *Found,
CXXConstructorDecl *Ctor,
bool Elidable,
ArrayRef<Expr *> Args,
ConstructionKind ConstructKind,
SourceRange ParenOrBraceRange);
- /// \brief Get the declaration that was found by name lookup.
- NamedDecl *getFoundDecl() const;
-
/// \brief Get the constructor that this expression will (ultimately) call.
CXXConstructorDecl *getConstructor() const { return Constructor; }
public:
CXXTemporaryObjectExpr(const ASTContext &C,
- NamedDecl *Found,
CXXConstructorDecl *Cons,
TypeSourceInfo *Type,
ArrayRef<Expr *> Args,
bool RequiresZeroInit, unsigned ConstructKind,
SourceRange ParenRange);
+ /// Build a CXXConstructExpr whose constructor has already been resolved if
+ /// it denotes an inherited constructor.
+ ExprResult
+ BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
+ CXXConstructorDecl *Constructor, bool Elidable,
+ MultiExprArg Exprs,
+ bool HadMultipleCandidates, bool IsListInitialization,
+ bool IsStdInitListInitialization,
+ bool RequiresZeroInit, unsigned ConstructKind,
+ SourceRange ParenRange);
+
// FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
// the constructor can be elidable?
ExprResult
if (T.isNull())
return nullptr;
- NamedDecl *ToFound =
- dyn_cast_or_null<NamedDecl>(Importer.Import(E->getFoundDecl()));
- if (!ToFound)
- return nullptr;
-
CXXConstructorDecl *ToCCD =
dyn_cast_or_null<CXXConstructorDecl>(Importer.Import(E->getConstructor()));
if (!ToCCD)
return CXXConstructExpr::Create(Importer.getToContext(), T,
Importer.Import(E->getLocation()),
- ToFound, ToCCD, E->isElidable(),
+ ToCCD, E->isElidable(),
ToArgs, E->hadMultipleCandidates(),
E->isListInitialization(),
E->isStdInitListInitialization(),
return End;
}
-NamedDecl *CXXConstructExpr::getFoundDecl() const {
- if (auto *Template = Constructor->getPrimaryTemplate())
- return Template;
- return Constructor;
-}
-
SourceRange CXXOperatorCallExpr::getSourceRangeImpl() const {
OverloadedOperatorKind Kind = getOperator();
if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
}
CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(const ASTContext &C,
- NamedDecl *Found,
CXXConstructorDecl *Cons,
TypeSourceInfo *Type,
ArrayRef<Expr*> Args,
: CXXConstructExpr(C, CXXTemporaryObjectExprClass,
Type->getType().getNonReferenceType(),
Type->getTypeLoc().getBeginLoc(),
- Found, Cons, false, Args,
+ Cons, false, Args,
HadMultipleCandidates,
ListInitialization,
StdInitListInitialization,
CXXConstructExpr *CXXConstructExpr::Create(const ASTContext &C, QualType T,
SourceLocation Loc,
- NamedDecl *Found,
CXXConstructorDecl *Ctor,
bool Elidable,
ArrayRef<Expr*> Args,
ConstructionKind ConstructKind,
SourceRange ParenOrBraceRange) {
return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, Loc,
- Found, Ctor, Elidable, Args,
+ Ctor, Elidable, Args,
HadMultipleCandidates, ListInitialization,
StdInitListInitialization,
ZeroInitialization, ConstructKind,
CXXConstructExpr::CXXConstructExpr(const ASTContext &C, StmtClass SC,
QualType T, SourceLocation Loc,
- NamedDecl *Found, CXXConstructorDecl *Ctor,
+ CXXConstructorDecl *Ctor,
bool Elidable,
ArrayRef<Expr*> Args,
bool HadMultipleCandidates,
ZeroInitialization(ZeroInitialization),
ConstructKind(ConstructKind), Args(nullptr)
{
- assert(declaresSameEntity(Found, Ctor) ||
- declaresSameEntity(Found, Ctor->getPrimaryTemplate()));
if (NumArgs) {
this->Args = new (C) Stmt*[Args.size()];
CXXConstructExpr *TheCXXConstructExpr =
CXXConstructExpr::Create(C, Ty, SourceLocation(),
- CXXConstExpr->getFoundDecl(),
CXXConstExpr->getConstructor(),
CXXConstExpr->isElidable(),
ConstructorArgs,
ConstructKind, ParenRange);
}
+ExprResult
+Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
+ NamedDecl *FoundDecl,
+ CXXConstructorDecl *Constructor,
+ bool Elidable,
+ MultiExprArg ExprArgs,
+ bool HadMultipleCandidates,
+ bool IsListInitialization,
+ bool IsStdInitListInitialization,
+ bool RequiresZeroInit,
+ unsigned ConstructKind,
+ SourceRange ParenRange) {
+ return BuildCXXConstructExpr(
+ ConstructLoc, DeclInitType, Constructor, Elidable, ExprArgs,
+ HadMultipleCandidates, IsListInitialization, IsStdInitListInitialization,
+ RequiresZeroInit, ConstructKind, ParenRange);
+}
+
/// BuildCXXConstructExpr - Creates a complete call to a constructor,
/// including handling of its default argument expressions.
ExprResult
Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
- NamedDecl *FoundDecl,
CXXConstructorDecl *Constructor,
bool Elidable,
MultiExprArg ExprArgs,
SourceRange ParenRange) {
MarkFunctionReferenced(ConstructLoc, Constructor);
return CXXConstructExpr::Create(
- Context, DeclInitType, ConstructLoc, FoundDecl, Constructor, Elidable,
+ Context, DeclInitType, ConstructLoc, Constructor, Elidable,
ExprArgs, HadMultipleCandidates, IsListInitialization,
IsStdInitListInitialization, RequiresZeroInit,
static_cast<CXXConstructExpr::ConstructionKind>(ConstructKind),
: Kind.getParenRange();
CurInit = new (S.Context) CXXTemporaryObjectExpr(
- S.Context, Step.Function.FoundDecl, Constructor, TSInfo,
+ S.Context, Constructor, TSInfo,
ConstructorArgs, ParenOrBraceRange, HadMultipleCandidates,
IsListInitialization, IsStdInitListInitialization,
ConstructorInitRequiresZeroInit);
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildCXXConstructExpr(QualType T,
SourceLocation Loc,
- NamedDecl *Found,
CXXConstructorDecl *Constructor,
bool IsElidable,
MultiExprArg Args,
ConvertedArgs))
return ExprError();
- return getSema().BuildCXXConstructExpr(Loc, T, Found, Constructor,
+ return getSema().BuildCXXConstructExpr(Loc, T, Constructor,
IsElidable,
ConvertedArgs,
HadMultipleCandidates,
if (T.isNull())
return ExprError();
- NamedDecl *FoundDecl = cast_or_null<NamedDecl>(
- getDerived().TransformDecl(E->getLocStart(), E->getFoundDecl()));
- if (!FoundDecl)
- return ExprError();
-
CXXConstructorDecl *Constructor
= cast_or_null<CXXConstructorDecl>(
getDerived().TransformDecl(E->getLocStart(),
if (!getDerived().AlwaysRebuild() &&
T == E->getType() &&
- FoundDecl == E->getFoundDecl() &&
Constructor == E->getConstructor() &&
!ArgumentChanged) {
// Mark the constructor as referenced.
}
return getDerived().RebuildCXXConstructExpr(T, /*FIXME:*/E->getLocStart(),
- FoundDecl, Constructor,
+ Constructor,
E->isElidable(), Args,
E->hadMultipleCandidates(),
E->isListInitialization(),