[cfe-commits] r89569 - in /cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGenCXX/const-init.cpp
Anders Carlsson
andersca at mac.com
Sat Nov 21 15:56:04 PST 2009
Author: andersca
Date: Sat Nov 21 17:56:04 2009
New Revision: 89569
URL: http://llvm.org/viewvc/llvm-project?rev=89569&view=rev
Log:
Support emitting aggregate class initializers. Fixes PR5581.
Modified:
cfe/trunk/lib/CodeGen/CGExprConstant.cpp
cfe/trunk/test/CodeGenCXX/const-init.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=89569&r1=89568&r2=89569&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Sat Nov 21 17:56:04 2009
@@ -673,7 +673,7 @@
if (ILE->getType()->isArrayType())
return EmitArrayInitialization(ILE);
- if (ILE->getType()->isStructureType())
+ if (ILE->getType()->isRecordType())
return EmitStructInitialization(ILE);
if (ILE->getType()->isUnionType())
Modified: cfe/trunk/test/CodeGenCXX/const-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/const-init.cpp?rev=89569&r1=89568&r2=89569&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/const-init.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/const-init.cpp Sat Nov 21 17:56:04 2009
@@ -1,11 +1,26 @@
-// RUN: clang-cc -verify -emit-llvm -o %t %s
+// RUN: clang-cc -verify -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s
+// CHECK: @a = global i32 10
int a = 10;
+// CHECK: @ar = global i32* @a
int &ar = a;
void f();
+// CHECK: @fr = global void ()* @_Z1fv
void (&fr)() = f;
struct S { int& a; };
+// CHECK: @s = global %0 { i32* @a }
S s = { a };
+// PR5581
+namespace PR5581 {
+class C {
+public:
+ enum { e0, e1 };
+ unsigned f;
+};
+
+// CHECK: @_ZN6PR55812g0E = global %1 { i32 1 }
+C g0 = { C::e1 };
+}
More information about the cfe-commits
mailing list