Patch fixes miscompile with non-trivial copy constructors and 
statement expressions, //rdar: //8540501


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117146 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGValue.h b/lib/CodeGen/CGValue.h
index a000b22..fd82be7 100644
--- a/lib/CodeGen/CGValue.h
+++ b/lib/CodeGen/CGValue.h
@@ -26,6 +26,7 @@
 namespace clang {
   class ObjCPropertyRefExpr;
   class ObjCImplicitSetterGetterRefExpr;
+  class CXXConstructExpr;
 
 namespace CodeGen {
   class CGBitFieldInfo;
@@ -335,6 +336,7 @@
 class AggValueSlot {
   /// The address.
   llvm::Value *Addr;
+  CXXConstructExpr *CtorExpr;
   
   // Associated flags.
   bool VolatileFlag : 1;
@@ -347,6 +349,7 @@
   static AggValueSlot ignored() {
     AggValueSlot AV;
     AV.Addr = 0;
+    AV.CtorExpr = 0;
     AV.VolatileFlag = AV.LifetimeFlag = AV.RequiresGCollection = 0;
     return AV;
   }
@@ -364,6 +367,7 @@
                               bool RequiresGCollection=false) {
     AggValueSlot AV;
     AV.Addr = Addr;
+    AV.CtorExpr = 0;
     AV.VolatileFlag = Volatile;
     AV.LifetimeFlag = LifetimeExternallyManaged;
     AV.RequiresGCollection = RequiresGCollection;
@@ -375,7 +379,10 @@
     return forAddr(LV.getAddress(), LV.isVolatileQualified(),
                    LifetimeExternallyManaged, RequiresGCollection);
   }
-
+  
+  void setCtorExpr(CXXConstructExpr *E) { CtorExpr = E; }
+  CXXConstructExpr *getCtorExpr() const { return CtorExpr; }
+  
   bool isLifetimeExternallyManaged() const {
     return LifetimeFlag;
   }