2011-10-14 06:29:44 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s
|
2011-05-19 13:13:44 +08:00
|
|
|
|
|
|
|
struct A {
|
|
|
|
~A();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct B {
|
|
|
|
~B() throw(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct C {
|
|
|
|
B b;
|
|
|
|
~C() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct D {
|
|
|
|
~D() noexcept(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct E {
|
|
|
|
D d;
|
|
|
|
~E() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
void foo() {
|
|
|
|
A a;
|
|
|
|
C c;
|
|
|
|
E e;
|
2011-06-07 05:23:05 +08:00
|
|
|
// CHECK: invoke {{.*}} @_ZN1ED1Ev
|
|
|
|
// CHECK: invoke {{.*}} @_ZN1CD1Ev
|
|
|
|
// CHECK: call {{.*}} @_ZN1AD1Ev
|
2011-05-19 13:13:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
struct F {
|
|
|
|
D d;
|
|
|
|
~F();
|
|
|
|
};
|
|
|
|
F::~F() noexcept(false) {}
|
|
|
|
|
|
|
|
struct G {
|
|
|
|
D d;
|
|
|
|
~G();
|
|
|
|
};
|
|
|
|
G::~G() {}
|
|
|
|
|
|
|
|
struct H {
|
|
|
|
B b;
|
2012-10-17 07:30:16 +08:00
|
|
|
~H() throw(int);
|
2011-05-19 13:13:44 +08:00
|
|
|
};
|
|
|
|
H::~H() throw(int) {}
|
|
|
|
|
|
|
|
struct I {
|
|
|
|
B b;
|
|
|
|
~I();
|
|
|
|
};
|
|
|
|
I::~I() {}
|
|
|
|
|
|
|
|
// Template variants.
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TA {
|
|
|
|
~TA();
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TB {
|
|
|
|
~TB() throw(int);
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TC {
|
|
|
|
TB<T> b;
|
|
|
|
~TC() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TD {
|
|
|
|
~TD() noexcept(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TE {
|
|
|
|
TD<T> d;
|
|
|
|
~TE() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
void tfoo() {
|
|
|
|
TA<int> a;
|
|
|
|
TC<int> c;
|
|
|
|
TE<int> e;
|
2011-06-07 05:23:05 +08:00
|
|
|
// CHECK: invoke {{.*}} @_ZN2TEIiED1Ev
|
|
|
|
// CHECK: invoke {{.*}} @_ZN2TCIiED1Ev
|
|
|
|
// CHECK: call {{.*}} @_ZN2TAIiED1Ev
|
2011-05-19 13:13:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TF {
|
|
|
|
TD<T> d;
|
|
|
|
~TF();
|
|
|
|
};
|
|
|
|
template <typename T>
|
|
|
|
TF<T>::~TF() noexcept(false) {}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TG {
|
|
|
|
TD<T> d;
|
|
|
|
~TG();
|
|
|
|
};
|
|
|
|
template <typename T>
|
|
|
|
TG<T>::~TG() {}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TH {
|
|
|
|
TB<T> b;
|
|
|
|
~TH();
|
|
|
|
};
|
|
|
|
template <typename T>
|
|
|
|
TH<T>::~TH() {}
|
|
|
|
|
|
|
|
void tinst() {
|
|
|
|
TF<int> f;
|
|
|
|
TG<int> g;
|
|
|
|
TH<int> h;
|
|
|
|
}
|
2011-06-07 05:23:05 +08:00
|
|
|
// CHECK: define linkonce_odr {{.*}} @_ZN2THIiED1Ev
|
2011-05-19 13:13:44 +08:00
|
|
|
// CHECK: _ZTIi
|
|
|
|
// CHECK: __cxa_call_unexpected
|
|
|
|
|
|
|
|
struct VX
|
|
|
|
{ virtual ~VX() {} };
|
|
|
|
|
|
|
|
struct VY : VX
|
|
|
|
{ virtual ~VY() {} };
|
|
|
|
|
2011-05-20 00:25:27 +08:00
|
|
|
template<typename T>
|
|
|
|
struct TVY : VX
|
|
|
|
{ virtual ~TVY() {} };
|
|
|
|
|
2011-05-19 13:13:44 +08:00
|
|
|
|
|
|
|
struct VA {
|
|
|
|
B b;
|
|
|
|
virtual ~VA() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VB : VA
|
|
|
|
{ virtual ~VB() {} };
|
2011-05-20 00:25:27 +08:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct TVB : VA
|
|
|
|
{ virtual ~TVB() {} };
|
|
|
|
|
|
|
|
void tinst2() {
|
|
|
|
TVY<int> tvy;
|
|
|
|
TVB<int> tvb;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct Sw {
|
|
|
|
T t;
|
|
|
|
~Sw() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
void tsw() {
|
|
|
|
Sw<int> swi;
|
|
|
|
Sw<B> swb;
|
|
|
|
}
|
2013-02-21 03:30:01 +08:00
|
|
|
// CHECK-NOT: define linkonce_odr {{.*}} @_ZN2SwI1BED1Ev({{.*}} #
|
2011-06-07 05:23:05 +08:00
|
|
|
// CHECK: define linkonce_odr {{.*}} @_ZN2SwI1BED1Ev({{.*}}
|
2011-05-20 00:25:27 +08:00
|
|
|
// CHECK: _ZTIi
|
|
|
|
// CHECK: __cxa_call_unexpected
|
2013-02-21 03:30:01 +08:00
|
|
|
// CHECK: define linkonce_odr {{.*}} @_ZN2SwIiED1Ev({{.*}} [[ATTRGRP:#[0-9]+]]
|
2011-05-20 13:57:18 +08:00
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TVC : VX
|
|
|
|
{ virtual ~TVC(); };
|
|
|
|
template <typename T>
|
|
|
|
TVC<T>::~TVC() {}
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-22 03:44:18 +08:00
|
|
|
// CHECK: attributes [[ATTRGRP]] = { nounwind{{.*}} }
|