Call PerformCopyInitialization to properly initialize the exception temporary
in a throw expression.  Use EmitAnyExprToMem to emit the throw expression,
which magically elides the final copy-constructor call (which raises a new
strict-compliance bug, but baby steps).  Give __cxa_throw a destructor pointer
if the exception type has a non-trivial destructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102039 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGTemporaries.cpp b/lib/CodeGen/CGTemporaries.cpp
index 6d38ab9..d6d3be5 100644
--- a/lib/CodeGen/CGTemporaries.cpp
+++ b/lib/CodeGen/CGTemporaries.cpp
@@ -23,7 +23,7 @@
          "Pushed the same temporary twice; AST is likely wrong");
   llvm::BasicBlock *DtorBlock = createBasicBlock("temp.dtor");
 
-  llvm::Value *CondPtr = 0;
+  llvm::AllocaInst *CondPtr = 0;
 
   // Check if temporaries need to be conditional. If so, we'll create a
   // condition boolean, initialize it to 0 and
@@ -32,10 +32,7 @@
 
     // Initialize it to false. This initialization takes place right after
     // the alloca insert point.
-    llvm::StoreInst *SI =
-      new llvm::StoreInst(llvm::ConstantInt::getFalse(VMContext), CondPtr);
-    llvm::BasicBlock *Block = AllocaInsertPt->getParent();
-    Block->getInstList().insertAfter((llvm::Instruction *)AllocaInsertPt, SI);
+    InitTempAlloca(CondPtr, llvm::ConstantInt::getFalse(VMContext));
 
     // Now set it to true.
     Builder.CreateStore(llvm::ConstantInt::getTrue(VMContext), CondPtr);