aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/anonymous-union-member-initializer.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-21 01:18:57 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-21 01:18:57 +0000
commita9976d3b192690db20f59dc44099ac4ca939bdb7 (patch)
treed803c7b2d650841a32cf0b36c87c68adfd47faaa /test/CodeGenCXX/anonymous-union-member-initializer.cpp
parentbc365c53606ab90537576cb48d93a54ce3fb0cb5 (diff)
When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous records. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/anonymous-union-member-initializer.cpp')
-rw-r--r--test/CodeGenCXX/anonymous-union-member-initializer.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGenCXX/anonymous-union-member-initializer.cpp b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
index bd816a4a44..a4da2c04fd 100644
--- a/test/CodeGenCXX/anonymous-union-member-initializer.cpp
+++ b/test/CodeGenCXX/anonymous-union-member-initializer.cpp
@@ -52,3 +52,29 @@ namespace test2 {
// CHECK: store i32 10
// CHECK: }
}
+
+namespace test3 {
+ struct A {
+ union {
+ mutable char fibers[100];
+ struct {
+ void (*callback)(void*);
+ void *callback_value;
+ };
+ };
+
+ A();
+ };
+
+ A::A() : callback(0), callback_value(0) {}
+ // CHECK: define void @ZN5test31AC2Ev(
+ // CHECK: [[THIS:%.*]] = load
+ // CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0
+ // CHECK-NEXT: [[STRUCT:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0
+ // CHECK-NEXT: [[CALLBACK:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 0
+ // CHECK-NEXT: store void (i8*)* null, void (i8*)** [[CALLBACK]]
+ // CHECK-NEXT: [[UNION:%.*]] = getelementptr inbounds {{.*}} [[THIS]], i32 0, i32 0
+ // CHECK-NEXT: [[STRUCT:%.*]] = getelementptr inbounds {{.*}} [[UNION]], i32 0, i32 0
+ // CHECK-NEXT: [[CVALUE:%.*]] = getelementptr inbounds {{.*}} [[STRUCT]], i32 0, i32 0
+ // CHECK-NEXT: store i8* null, void i8** [[CVALUE]]
+}