2012-10-24 20:22:56 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fexceptions -fcxx-exceptions -std=c++11 -o - %s | FileCheck %s
|
2011-05-01 15:04:31 +08:00
|
|
|
|
|
|
|
struct non_trivial {
|
|
|
|
non_trivial();
|
2011-05-19 13:13:44 +08:00
|
|
|
~non_trivial() noexcept(false);
|
2011-05-01 15:04:31 +08:00
|
|
|
};
|
|
|
|
non_trivial::non_trivial() {}
|
2011-05-19 13:13:44 +08:00
|
|
|
non_trivial::~non_trivial() noexcept(false) {}
|
2011-05-01 15:04:31 +08:00
|
|
|
|
|
|
|
// We use a virtual base to ensure that the constructor
|
|
|
|
// delegation optimization (complete->base) can't be
|
|
|
|
// performed.
|
|
|
|
struct delegator {
|
|
|
|
non_trivial n;
|
|
|
|
delegator();
|
|
|
|
delegator(int);
|
|
|
|
delegator(char);
|
|
|
|
delegator(bool);
|
|
|
|
};
|
|
|
|
|
|
|
|
delegator::delegator() {
|
|
|
|
throw 0;
|
|
|
|
}
|
|
|
|
|
2011-05-04 07:05:34 +08:00
|
|
|
|
|
|
|
delegator::delegator(bool)
|
|
|
|
{}
|
|
|
|
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: define {{.*}} @_ZN9delegatorC1Ec
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC1Eb
|
2011-05-04 07:05:34 +08:00
|
|
|
// CHECK: void @__cxa_throw
|
2013-02-12 11:51:46 +08:00
|
|
|
// CHECK: void @__clang_call_terminate
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: {{.*}} @_ZN9delegatorD1Ev
|
|
|
|
// CHECK: define {{.*}} @_ZN9delegatorC2Ec
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC2Eb
|
2011-05-04 07:05:34 +08:00
|
|
|
// CHECK: void @__cxa_throw
|
2013-02-12 11:51:46 +08:00
|
|
|
// CHECK: void @__clang_call_terminate
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: {{.*}} @_ZN9delegatorD2Ev
|
2011-05-04 07:05:34 +08:00
|
|
|
delegator::delegator(char)
|
|
|
|
: delegator(true) {
|
|
|
|
throw 0;
|
|
|
|
}
|
|
|
|
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: define {{.*}} @_ZN9delegatorC1Ei
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC1Ev
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-05-01 15:04:31 +08:00
|
|
|
// CHECK: ret
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-06-14 06:51:21 +08:00
|
|
|
// CHECK: define {{.*}} @_ZN9delegatorC2Ei
|
|
|
|
// CHECK: {{.*}} @_ZN9delegatorC2Ev
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-05-01 15:04:31 +08:00
|
|
|
// CHECK: ret
|
2011-05-04 08:59:33 +08:00
|
|
|
// CHECK-NOT: void @_ZSt9terminatev
|
2011-05-01 15:04:31 +08:00
|
|
|
delegator::delegator(int)
|
|
|
|
: delegator()
|
|
|
|
{}
|
2012-05-20 08:46:05 +08:00
|
|
|
|
|
|
|
namespace PR12890 {
|
|
|
|
class X {
|
|
|
|
int x;
|
|
|
|
X() = default;
|
|
|
|
X(int);
|
|
|
|
};
|
|
|
|
X::X(int) : X() {}
|
|
|
|
}
|
|
|
|
// CHECK: define {{.*}} @_ZN7PR128901XC1Ei(%"class.PR12890::X"* %this, i32)
|
2012-05-20 14:43:46 +08:00
|
|
|
// CHECK: call void @llvm.memset.p0i8.{{i32|i64}}(i8* {{.*}}, i8 0, {{i32|i64}} 4, i32 4, i1 false)
|
2013-01-31 13:50:40 +08:00
|
|
|
|
|
|
|
namespace PR14588 {
|
|
|
|
void other();
|
|
|
|
|
|
|
|
class Base {
|
|
|
|
public:
|
|
|
|
Base() { squawk(); }
|
|
|
|
virtual ~Base() {}
|
|
|
|
|
|
|
|
virtual void squawk() { other(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class Foo : public virtual Base {
|
|
|
|
public:
|
|
|
|
Foo();
|
|
|
|
Foo(const void * inVoid);
|
|
|
|
virtual ~Foo() {}
|
|
|
|
|
|
|
|
virtual void squawk() { other(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: define void @_ZN7PR145883FooC1Ev(%"class.PR14588::Foo"*
|
|
|
|
// CHECK: call void @_ZN7PR145883FooC1EPKv(
|
|
|
|
// CHECK: invoke void @_ZN7PR145885otherEv()
|
|
|
|
// CHECK: call void @_ZN7PR145883FooD1Ev
|
|
|
|
// CHECK: resume
|
|
|
|
|
|
|
|
Foo::Foo() : Foo(__null) { other(); }
|
|
|
|
Foo::Foo(const void *inVoid) {
|
|
|
|
squawk();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|