diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-05-07 06:28:46 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-05-07 06:28:46 +0000 |
commit | 43f7439cf59edd0f4400a12036f8a19745369f3f (patch) | |
tree | 58ff1a179c399ea839926b518367d4f5cbcb438f /clang/test | |
parent | ece0a3f69cd04487b936d3b9c559fb07686b3ecc (diff) | |
download | bcm5719-llvm-43f7439cf59edd0f4400a12036f8a19745369f3f.tar.gz bcm5719-llvm-43f7439cf59edd0f4400a12036f8a19745369f3f.zip |
Fix for http://llvm.org/PR23392: magick/feature.c from ImageMagick-6.9.1-2 ICEs.
Fix for codegen of static variables declared inside of captured statements. Captured statements are actually a transparent DeclContexts, so we have to skip them when trying to get a mangled name for statics.
Differential Revision: http://reviews.llvm.org/D9522
llvm-svn: 236701
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/captured-statements.c | 3 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/captured-statements.cpp | 14 |
2 files changed, 13 insertions, 4 deletions
diff --git a/clang/test/CodeGen/captured-statements.c b/clang/test/CodeGen/captured-statements.c index 64af3c06047..53861097d7c 100644 --- a/clang/test/CodeGen/captured-statements.c +++ b/clang/test/CodeGen/captured-statements.c @@ -14,9 +14,12 @@ void test1() { int i = 0; #pragma clang __debug captured { + static float inner = 3.0; + (void)inner; i++; } // CHECK-1: %struct.anon = type { i32* } + // CHECK-1: {{.+}} global float 3.0 // // CHECK-1: test1 // CHECK-1: alloca %struct.anon diff --git a/clang/test/CodeGenCXX/captured-statements.cpp b/clang/test/CodeGenCXX/captured-statements.cpp index 56fe4c61c98..058e7378938 100644 --- a/clang/test/CodeGenCXX/captured-statements.cpp +++ b/clang/test/CodeGenCXX/captured-statements.cpp @@ -21,6 +21,8 @@ struct TestClass { Foo f; #pragma clang __debug captured { + static double inner = x; + (void)inner; f.y = x; } } @@ -29,22 +31,26 @@ struct TestClass { void test1() { TestClass c; c.MemberFunc(); - // CHECK-1: %[[Capture:struct\.anon[\.0-9]*]] = type { %struct.Foo*, %struct.TestClass* } + // CHECK-1: %[[Capture:struct\.anon[\.0-9]*]] = type { %struct.TestClass*, %struct.Foo* } + // CHECK-1: [[INNER:@.+]] = {{.+}} global double // CHECK-1: define {{.*}} void @_ZN9TestClass10MemberFuncEv // CHECK-1: alloca %struct.anon // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* %{{[^,]*}}, i32 0, i32 0 - // CHECK-1: store %struct.Foo* %f, %struct.Foo** // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* %{{[^,]*}}, i32 0, i32 1 + // CHECK-1: store %struct.Foo* %f, %struct.Foo** // CHECK-1: call void @[[HelperName:[A-Za-z0-9_]+]](%[[Capture]]* // CHECK-1: call {{.*}}FooD1Ev // CHECK-1: ret } // CHECK-1: define internal void @[[HelperName]] -// CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 1 -// CHECK-1: getelementptr inbounds %struct.TestClass, %struct.TestClass* {{[^,]*}}, i32 0, i32 0 // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 0 +// CHECK-1: call i32 @__cxa_guard_acquire( +// CHECK-1: store double %{{.+}}, double* [[INNER]], +// CHECK-1: call void @__cxa_guard_release( +// CHECK-1: getelementptr inbounds %struct.TestClass, %struct.TestClass* {{[^,]*}}, i32 0, i32 0 +// CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 1 void test2(int x) { int y = [&]() { |