]> granicus.if.org Git - clang/commitdiff
Make initialization of complex vars work.
authorChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 05:13:54 +0000 (05:13 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 26 Aug 2007 05:13:54 +0000 (05:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41426 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGDecl.cpp

index 8489cbabd8971e7a0191cf55195f182e31de1f4a..223228817c34b3cac35b9c70da58eb728c5654c6 100644 (file)
@@ -85,8 +85,12 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const BlockVarDecl &D) {
   
   // 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);
+    }
   }
 }