]> granicus.if.org Git - clang/commitdiff
Revert accidental commit
authorDouglas Gregor <dgregor@apple.com>
Sun, 20 Dec 2009 21:10:58 +0000 (21:10 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 20 Dec 2009 21:10:58 +0000 (21:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91795 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index a80d62a473807de78abe0ed91dad104e835c9c0d..c873f3957979452bc28285c99de129e942f16c81 100644 (file)
@@ -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<Expr>()));
+            // FIXME: Cope with initialization of arrays
+            if (!Constructor->isTrivial() &&
+                InitializeVarWithConstructor(Var, Constructor, 
+                                             move_arg(ConstructorArgs)))
+              Var->setInvalidDecl();
+            
             FinalizeVarWithDestructor(Var, InitType);
           }
         } else {