]> granicus.if.org Git - clang/commitdiff
Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub...
authorAnders Carlsson <andersca@mac.com>
Tue, 19 May 2009 04:48:36 +0000 (04:48 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 19 May 2009 04:48:36 +0000 (04:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72103 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CGExprScalar.cpp

index b216cf70a49b33ed9726198233b9a620167be117..92e535a5f062d65c98844738cc51457992415213 100644 (file)
@@ -99,6 +99,8 @@ public:
     Visit(DAE->getExpr());
   }
   void VisitCXXConstructExpr(const CXXConstructExpr *E);
+  void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E);
+
   void VisitVAArgExpr(VAArgExpr *E);
 
   void EmitInitializationToLValue(Expr *E, LValue Address);
@@ -295,9 +297,22 @@ void AggExprEmitter::VisitVAArgExpr(VAArgExpr *VE) {
 
 void
 AggExprEmitter::VisitCXXConstructExpr(const CXXConstructExpr *E) {
-  assert(DestPtr && "Must have a dest to emit into!");
+  llvm::Value *V = DestPtr;
+  
+  if (!V) {
+    assert(isa<CXXTempVarDecl>(E->getVarDecl()) && 
+           "Must have a temp var decl when there's no destination!");
+    
+    V = CGF.CreateTempAlloca(CGF.ConvertType(E->getVarDecl()->getType()), 
+                             "tmpvar");
+  }
   
-  CGF.EmitCXXConstructExpr(DestPtr, E);
+  CGF.EmitCXXConstructExpr(V, E);
+}
+
+void AggExprEmitter::VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
+  // FIXME: Do something with the temporaries!
+  Visit(E->getSubExpr());
 }
 
 void AggExprEmitter::EmitInitializationToLValue(Expr* E, LValue LV) {
index 5e0159e597d79c78d13ef2a5f28828009f9e8e65..6ceb2a67900f9271729d7456bd471d72e42e0a2b 100644 (file)
@@ -269,6 +269,11 @@ public:
     return CGF.LoadCXXThis();
   }      
     
+  Value *VisitCXXExprWithTemporaries(CXXExprWithTemporaries *E) {
+    // FIXME: Do something with the temporaries!
+    return Visit(E->getSubExpr());
+  }
+      
   // Binary Operators.
   Value *EmitMul(const BinOpInfo &Ops) {
     if (CGF.getContext().getLangOptions().OverflowChecking