[cfe-commits] r151549 - in /cfe/trunk: lib/CodeGen/CGExprComplex.cpp test/CodeGen/complex-init-list.c

Eli Friedman eli.friedman at gmail.com
Mon Feb 27 12:26:13 PST 2012


Author: efriedma
Date: Mon Feb 27 14:26:13 2012
New Revision: 151549

URL: http://llvm.org/viewvc/llvm-project?rev=151549&view=rev
Log:
Add missing code for compound literals of complex type.  <rdar://problem/10938628>


Modified:
    cfe/trunk/lib/CodeGen/CGExprComplex.cpp
    cfe/trunk/test/CodeGen/complex-init-list.c

Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=151549&r1=151548&r2=151549&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Mon Feb 27 14:26:13 2012
@@ -261,6 +261,10 @@
 
   ComplexPairTy VisitInitListExpr(InitListExpr *E);
 
+  ComplexPairTy VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+    return EmitLoadOfLValue(E);
+  }
+
   ComplexPairTy VisitVAArgExpr(VAArgExpr *E);
 
   ComplexPairTy VisitAtomicExpr(AtomicExpr *E) {

Modified: cfe/trunk/test/CodeGen/complex-init-list.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/complex-init-list.c?rev=151549&r1=151548&r2=151549&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/complex-init-list.c (original)
+++ cfe/trunk/test/CodeGen/complex-init-list.c Mon Feb 27 14:26:13 2012
@@ -9,4 +9,10 @@
 
 _Complex float f(float x, float y) { _Complex float z = { x, y }; return z; }
 // CHECK: define <2 x float> @f
-// CHECK: alloca { float, float }
\ No newline at end of file
+// CHECK: alloca { float, float }
+// CHECK: alloca { float, float }
+
+_Complex float f2(float x, float y) { return (_Complex float){ x, y }; }
+// CHECK: define <2 x float> @f2
+// CHECK: alloca { float, float }
+// CHECK: alloca { float, float }





More information about the cfe-commits mailing list