diff options
author | John McCall <rjmccall@apple.com> | 2011-07-11 19:35:02 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-07-11 19:35:02 +0000 |
commit | 2b30dcfb769e4015f8d41c5c9a4e723ff3d522a0 (patch) | |
tree | 72de9177d5ad10f9e097ecab6a0b62da54fa8c86 /test/CodeGenCXX/partial-destruction.cpp | |
parent | 4e7c7f2b78ac3930e45f00626ef6acf08b3f80ca (diff) |
Emit partial destruction of structs with initializer lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134913 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/partial-destruction.cpp')
-rw-r--r-- | test/CodeGenCXX/partial-destruction.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/CodeGenCXX/partial-destruction.cpp b/test/CodeGenCXX/partial-destruction.cpp index 53b34d06bf..52995523bf 100644 --- a/test/CodeGenCXX/partial-destruction.cpp +++ b/test/CodeGenCXX/partial-destruction.cpp @@ -88,3 +88,33 @@ namespace test0 { // CHECK-NEXT: br i1 [[T0]], } + +namespace test1 { + struct A { A(); A(int); ~A(); }; + struct B { A x, y, z; int w; }; + + void test() { + B v = { 5, 6, 7, 8 }; + } + // CHECK: define void @_ZN5test14testEv() + // CHECK: [[V:%.*]] = alloca [[B:%.*]], align 4 + // CHECK-NEXT: alloca i8* + // CHECK-NEXT: alloca i32 + // CHECK-NEXT: alloca i32 + // CHECK-NEXT: [[X:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 0 + // CHECK-NEXT: call void @_ZN5test11AC1Ei([[A:%.*]]* [[X]], i32 5) + // CHECK-NEXT: [[Y:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 1 + // CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[Y]], i32 6) + // CHECK: [[Z:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 2 + // CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[Z]], i32 7) + // CHECK: [[W:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 3 + // CHECK-NEXT: store i32 8, i32* [[W]], align 4 + // CHECK-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[V]]) + // CHECK-NEXT: ret void + + // FIXME: again, the block ordering is pretty bad here + // CHECK: eh.selector({{.*}}, i32 0) + // CHECK: eh.selector({{.*}}, i32 0) + // CHECK: invoke void @_ZN5test11AD1Ev([[A]]* [[Y]]) + // CHECK: invoke void @_ZN5test11AD1Ev([[A]]* [[X]]) +} |