2016-10-14 09:12:20 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
2009-06-16 11:37:31 +08:00
|
|
|
|
|
|
|
struct T {
|
|
|
|
T();
|
|
|
|
~T();
|
|
|
|
};
|
|
|
|
|
|
|
|
void f(const T& t = T());
|
|
|
|
|
2009-08-06 02:17:32 +08:00
|
|
|
class X { // ...
|
|
|
|
public:
|
|
|
|
X();
|
|
|
|
X(const X&, const T& t = T());
|
|
|
|
};
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1gv()
|
2009-06-16 11:37:31 +08:00
|
|
|
void g() {
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call void @_ZN1TC1Ev([[T:%.*]]* [[AGG1:%.*]])
|
2014-07-18 23:52:10 +08:00
|
|
|
// CHECK-NEXT: call void @_Z1fRK1T([[T]]* dereferenceable({{[0-9]+}}) [[AGG1]])
|
2010-05-04 09:53:42 +08:00
|
|
|
// CHECK-NEXT: call void @_ZN1TD1Ev([[T]]* [[AGG1]])
|
2009-06-16 11:37:31 +08:00
|
|
|
f();
|
2010-05-04 09:53:42 +08:00
|
|
|
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK-NEXT: call void @_ZN1TC1Ev([[T:%.*]]* [[AGG2:%.*]])
|
2014-07-18 23:52:10 +08:00
|
|
|
// CHECK-NEXT: call void @_Z1fRK1T([[T]]* dereferenceable({{[0-9]+}}) [[AGG2]])
|
2010-05-04 09:53:42 +08:00
|
|
|
// CHECK-NEXT: call void @_ZN1TD1Ev([[T]]* [[AGG2]])
|
2009-06-16 11:37:31 +08:00
|
|
|
f();
|
2009-08-06 02:17:32 +08:00
|
|
|
|
2010-05-04 09:53:42 +08:00
|
|
|
// CHECK-NEXT: call void @_ZN1XC1Ev(
|
2009-08-06 02:17:32 +08:00
|
|
|
X a;
|
2010-05-04 09:53:42 +08:00
|
|
|
|
|
|
|
// CHECK-NEXT: call void @_ZN1TC1Ev(
|
|
|
|
// CHECK-NEXT: call void @_ZN1XC1ERKS_RK1T(
|
|
|
|
// CHECK-NEXT: call void @_ZN1TD1Ev(
|
2009-08-06 02:17:32 +08:00
|
|
|
X b(a);
|
2010-05-04 09:53:42 +08:00
|
|
|
|
|
|
|
// CHECK-NEXT: call void @_ZN1TC1Ev(
|
|
|
|
// CHECK-NEXT: call void @_ZN1XC1ERKS_RK1T(
|
|
|
|
// CHECK-NEXT: call void @_ZN1TD1Ev(
|
2009-08-06 02:17:32 +08:00
|
|
|
X c = a;
|
2009-06-16 11:37:31 +08:00
|
|
|
}
|
2009-10-18 23:18:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
class obj{ int a; float b; double d; };
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1hv()
|
2009-10-18 23:18:11 +08:00
|
|
|
void h() {
|
2010-05-04 09:53:42 +08:00
|
|
|
// CHECK: call void @llvm.memset.p0i8.i64(
|
2009-10-18 23:18:11 +08:00
|
|
|
obj o = obj();
|
|
|
|
}
|
2010-05-04 09:53:42 +08:00
|
|
|
|
|
|
|
// PR7028 - mostly this shouldn't crash
|
|
|
|
namespace test1 {
|
|
|
|
struct A { A(); };
|
|
|
|
struct B { B(); ~B(); };
|
|
|
|
|
|
|
|
struct C {
|
|
|
|
C(const B &file = B());
|
|
|
|
};
|
|
|
|
C::C(const B &file) {}
|
|
|
|
|
|
|
|
struct D {
|
|
|
|
C c;
|
|
|
|
A a;
|
|
|
|
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN5test11DC2Ev(%"struct.test1::D"* %this) unnamed_addr
|
2010-05-04 09:53:42 +08:00
|
|
|
// CHECK: call void @_ZN5test11BC1Ev(
|
|
|
|
// CHECK-NEXT: call void @_ZN5test11CC1ERKNS_1BE(
|
|
|
|
// CHECK-NEXT: call void @_ZN5test11BD1Ev(
|
|
|
|
// CHECK: call void @_ZN5test11AC1Ev(
|
|
|
|
D() : c(), a() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
D d;
|
|
|
|
}
|
2016-10-14 09:12:20 +08:00
|
|
|
|
|
|
|
namespace test2 {
|
|
|
|
// CHECK: define linkonce_odr void @_ZN5test21AIiED2Ev(
|
|
|
|
template <typename T> struct A { A() {} ~A() {} };
|
|
|
|
template <typename> void f(const A<int> & = {}) {}
|
|
|
|
void g() { f<int>(); }
|
|
|
|
}
|