[cfe-commits] r41426 - /cfe/trunk/CodeGen/CGDecl.cpp

Chris Lattner sabre at nondot.org
Sat Aug 25 22:13:55 PDT 2007


Author: lattner
Date: Sun Aug 26 00:13:54 2007
New Revision: 41426

URL: http://llvm.org/viewvc/llvm-project?rev=41426&view=rev
Log:
Make initialization of complex vars work.

Modified:
    cfe/trunk/CodeGen/CGDecl.cpp

Modified: cfe/trunk/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGDecl.cpp?rev=41426&r1=41425&r2=41426&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/CodeGen/CGDecl.cpp Sun Aug 26 00:13:54 2007
@@ -85,8 +85,12 @@
   
   // If this local has an initializer, emit it now.
   if (const Expr *Init = D.getInit()) {
-    // FIXME: This could be much better for aggregates / complex.
-    EmitStoreThroughLValue(EmitAnyExpr(Init), LValue::MakeAddr(DeclPtr), Ty);
+    if (Init->getType()->isComplexType()) {
+      EmitComplexExprIntoAddr(Init, DeclPtr);
+    } else {
+      // FIXME: This could be much better for aggregates.
+      EmitStoreThroughLValue(EmitAnyExpr(Init), LValue::MakeAddr(DeclPtr), Ty);
+    }
   }
 }
 





More information about the cfe-commits mailing list