Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / default-arg-temps.cpp
blob605407c17da68371edbec9557e240a63c68d015b
1 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
3 struct T {
4 T();
5 ~T();
6 };
8 void f(const T& t = T());
10 class X { // ...
11 public:
12 X();
13 X(const X&, const T& t = T());
16 // CHECK-LABEL: define{{.*}} void @_Z1gv()
17 void g() {
18 // CHECK: call void @_ZN1TC1Ev(ptr {{[^,]*}} [[AGG1:%.*]])
19 // CHECK-NEXT: call void @_Z1fRK1T(ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[AGG1]])
20 // CHECK-NEXT: call void @_ZN1TD1Ev(ptr {{[^,]*}} [[AGG1]])
21 f();
23 // CHECK-NEXT: call void @_ZN1TC1Ev(ptr {{[^,]*}} [[AGG2:%.*]])
24 // CHECK-NEXT: call void @_Z1fRK1T(ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) [[AGG2]])
25 // CHECK-NEXT: call void @_ZN1TD1Ev(ptr {{[^,]*}} [[AGG2]])
26 f();
28 // CHECK-NEXT: call void @_ZN1XC1Ev(
29 X a;
31 // CHECK-NEXT: call void @_ZN1TC1Ev(
32 // CHECK-NEXT: call void @_ZN1XC1ERKS_RK1T(
33 // CHECK-NEXT: call void @_ZN1TD1Ev(
34 X b(a);
36 // CHECK-NEXT: call void @_ZN1TC1Ev(
37 // CHECK-NEXT: call void @_ZN1XC1ERKS_RK1T(
38 // CHECK-NEXT: call void @_ZN1TD1Ev(
39 X c = a;
43 class obj{ int a; float b; double d; };
44 // CHECK-LABEL: define{{.*}} void @_Z1hv()
45 void h() {
46 // CHECK: call void @llvm.memset.p0.i64(
47 obj o = obj();
50 // PR7028 - mostly this shouldn't crash
51 namespace test1 {
52 struct A { A(); };
53 struct B { B(); ~B(); };
55 struct C {
56 C(const B &file = B());
58 C::C(const B &file) {}
60 struct D {
61 C c;
62 A a;
64 // CHECK-LABEL: define linkonce_odr void @_ZN5test11DC2Ev(ptr {{[^,]*}} %this) unnamed_addr
65 // CHECK: call void @_ZN5test11BC1Ev(
66 // CHECK-NEXT: call void @_ZN5test11CC1ERKNS_1BE(
67 // CHECK-NEXT: call void @_ZN5test11BD1Ev(
68 // CHECK: call void @_ZN5test11AC1Ev(
69 D() : c(), a() {}
72 D d;
75 namespace test2 {
76 // CHECK: define linkonce_odr void @_ZN5test21AIiED2Ev(
77 template <typename T> struct A { A() {} ~A() {} };
78 template <typename> void f(const A<int> & = {}) {}
79 void g() { f<int>(); }