From: Douglas Gregor Date: Sun, 20 Dec 2009 21:10:58 +0000 (+0000) Subject: Revert accidental commit X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=947f633616bf2239cf0d03598a85d90f1e36664b;p=clang Revert accidental commit git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91795 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a80d62a473..c873f39579 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3745,19 +3745,28 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl, InitType->isRecordType() && !InitType->isDependentType()) { if (!RequireCompleteType(Var->getLocation(), InitType, diag::err_invalid_incomplete_type_use)) { - InitializedEntity Entity - = InitializedEntity::InitializeVariable(Var); - InitializationKind Kind - = InitializationKind::CreateDefault(Var->getLocation()); - - InitializationSequence InitSeq(*this, Entity, Kind, 0, 0); - OwningExprResult Init = InitSeq.Perform(*this, Entity, Kind, - MultiExprArg(*this, 0, 0)); - if (Init.isInvalid()) + ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this); + + CXXConstructorDecl *Constructor + = PerformInitializationByConstructor(InitType, + MultiExprArg(*this, 0, 0), + Var->getLocation(), + SourceRange(Var->getLocation(), + Var->getLocation()), + Var->getDeclName(), + InitializationKind::CreateDefault(Var->getLocation()), + ConstructorArgs); + + // FIXME: Location info for the variable initialization? + if (!Constructor) Var->setInvalidDecl(); else { - Var->setInit(Context, - MaybeCreateCXXExprWithTemporaries(Init.takeAs())); + // FIXME: Cope with initialization of arrays + if (!Constructor->isTrivial() && + InitializeVarWithConstructor(Var, Constructor, + move_arg(ConstructorArgs))) + Var->setInvalidDecl(); + FinalizeVarWithDestructor(Var, InitType); } } else {