2017-01-10 02:24:16 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
|
|
|
|
// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
|
2010-10-06 04:48:15 +08:00
|
|
|
|
|
|
|
// 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(); };
|
|
|
|
|
2021-11-09 01:09:49 +08:00
|
|
|
// CHECK-LABEL: define linkonce_odr i32 @_ZN5test04testILi0EEEii
|
2010-10-06 06:36:42 +08:00
|
|
|
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*
|
2011-05-29 05:13:02 +08:00
|
|
|
// CHECK-NEXT: [[SEL:%.*]] = alloca i32
|
2010-10-06 06:36:42 +08:00
|
|
|
// CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*,
|
|
|
|
// CHECK-NEXT: [[TMP:%.*]] = alloca [[A]]
|
|
|
|
// CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
|
2020-11-17 07:04:55 +08:00
|
|
|
// CHECK: call void @_ZN5test01AC1Ev([[A]]* {{[^,]*}} [[Y]])
|
|
|
|
// CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* {{[^,]*}} [[Z]])
|
2021-11-09 01:09:49 +08:00
|
|
|
// CHECK: [[NEW:%.*]] = invoke noalias nonnull i8* @_Znwm(i64 1)
|
2011-11-10 18:43:54 +08:00
|
|
|
// CHECK: store i1 true, i1* [[CLEANUPACTIVE]]
|
2010-10-06 06:36:42 +08:00
|
|
|
// CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]*
|
2020-11-17 07:04:55 +08:00
|
|
|
// CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* {{[^,]*}} [[TMP]])
|
2021-11-09 01:09:49 +08:00
|
|
|
// CHECK: invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* {{[^,]*}} [[NEWCAST]], [[A]]* nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[TMP]])
|
2010-10-06 06:36:42 +08:00
|
|
|
// CHECK: store i1 false, i1* [[CLEANUPACTIVE]]
|
2017-01-10 02:24:16 +08:00
|
|
|
|
2020-11-17 07:04:55 +08:00
|
|
|
// CHECK98-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* {{[^,]*}} [[TMP]])
|
|
|
|
// CHECK11-NEXT: call void @_ZN5test01AD1Ev([[A]]* {{[^,]*}} [[TMP]])
|
2010-10-06 06:36:42 +08:00
|
|
|
A y;
|
|
|
|
try {
|
|
|
|
A z;
|
|
|
|
V *v = new V();
|
2010-10-06 04:48:15 +08:00
|
|
|
|
2010-10-06 06:36:42 +08:00
|
|
|
if (x) return 1;
|
|
|
|
} catch (int ex) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2010-10-06 04:48:15 +08:00
|
|
|
|
2010-10-06 06:36:42 +08:00
|
|
|
int test() {
|
|
|
|
return test<0>(5);
|
|
|
|
}
|
2010-10-06 04:48:15 +08:00
|
|
|
}
|