diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 13:06:31 +0000 |
commit | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch) | |
tree | a9243275843fbeaa590afc07ee888e006b8d54ea /test/CodeGenCXX/goto.cpp | |
parent | 69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff) | |
download | FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz |
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'test/CodeGenCXX/goto.cpp')
-rw-r--r-- | test/CodeGenCXX/goto.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/CodeGenCXX/goto.cpp b/test/CodeGenCXX/goto.cpp new file mode 100644 index 0000000..938d4e1 --- /dev/null +++ b/test/CodeGenCXX/goto.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fexceptions -emit-llvm -o - | FileCheck %s + +// Reduced from a crash on boost::interprocess's node_allocator_test.cpp. +namespace test0 { + struct A { A(); ~A(); }; + struct V { V(const A &a = A()); ~V(); }; + + // CHECK: define linkonce_odr i32 @_ZN5test04testILi0EEEii + template<int X> int test(int x) { + // CHECK: [[RET:%.*]] = alloca i32 + // CHECK-NEXT: [[X:%.*]] = alloca i32 + // CHECK-NEXT: [[Y:%.*]] = alloca [[A:%.*]], + // CHECK-NEXT: [[Z:%.*]] = alloca [[A]] + // CHECK-NEXT: [[EXN:%.*]] = alloca i8* + // CHECK-NEXT: alloca i32 + // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*, + // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]] + // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1 + // CHECK: store i1 true, i1* [[CLEANUPACTIVE]] + // CHECK: call void @_ZN5test01AC1Ev([[A]]* [[Y]]) + // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[Z]]) + // CHECK: [[NEW:%.*]] = invoke noalias i8* @_Znwm(i64 1) + // CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]* + // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]]) + // CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* [[TMP]]) + // CHECK: store i1 false, i1* [[CLEANUPACTIVE]] + // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]]) + A y; + try { + A z; + V *v = new V(); + + if (x) return 1; + } catch (int ex) { + return 1; + } + return 0; + } + + int test() { + return test<0>(5); + } +} |