Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-limited-ctor.cpp
blob18adfdeed048054027fde4d3a6b3f1ae78a59fae
1 // RUN: %clang_cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -debug-info-kind=constructor -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s
4 // CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue
5 struct A {
6 } TestA;
8 // CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "B"{{.*}}flags: DIFlagFwdDecl
9 struct B {
10 B();
11 } TestB;
13 // CHECK-DAG: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C"{{.*}}DIFlagTypePassByValue
14 struct C {
15 C() {}
16 } TestC;
18 // CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "D"{{.*}}DIFlagTypePassByValue
19 struct D {
20 D();
22 D::D() {}
24 // Test for constexpr constructor.
25 // CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "E"{{.*}}DIFlagTypePassByValue
26 struct E {
27 constexpr E(){};
28 } TestE;
30 // Test for trivial constructor.
31 // CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "F"{{.*}}DIFlagTypePassByValue
32 struct F {
33 F() = default;
34 F(int) {}
35 int i;
36 } TestF;
38 // Test for trivial constructor.
39 // CHECK-DAG: ![[G:.*]] ={{.*}}!DICompositeType({{.*}}name: "G"{{.*}}DIFlagTypePassByValue
40 // CHECK-DAG: !DICompositeType({{.*}}scope: ![[G]], {{.*}}DIFlagTypePassByValue
41 struct G {
42 G() : g_(0) {}
43 struct {
44 int g_;
46 } TestG;
48 // Test for an aggregate class with an implicit non-trivial default constructor
49 // that is not instantiated.
50 // CHECK-DAG: !DICompositeType({{.*}}name: "H",{{.*}}DIFlagTypePassByValue
51 struct H {
52 B b;
54 void f(H h) {}
56 // Test for an aggregate class with an implicit non-trivial default constructor
57 // that is instantiated.
58 // CHECK-DAG: !DICompositeType({{.*}}name: "J",{{.*}}DIFlagTypePassByValue
59 struct J {
60 B b;
62 void f(decltype(J()) j) {}
64 // Test for a class with trivial default constructor that is not instantiated.
65 // CHECK-DAG: !DICompositeType({{.*}}name: "K",{{.*}}DIFlagTypePassByValue
66 class K {
67 int i;
69 void f(K k) {}
71 // CHECK-DAG: !DICompositeType({{.*}}name: "DeletedCtors",{{.*}}DIFlagTypePassBy
72 struct NonTrivial {
73 NonTrivial();
75 struct DeletedCtors {
76 DeletedCtors() = delete;
77 DeletedCtors(const DeletedCtors &) = default;
78 void f1();
79 NonTrivial t;
82 const NonTrivial &f(const DeletedCtors &D) {
83 return D.t;
86 // Test that we don't use constructor homing on lambdas.
87 // CHECK-DAG: ![[L:.*]] ={{.*}}!DISubprogram({{.*}}name: "L"
88 // CHECK-DAG: !DICompositeType({{.*}}scope: ![[L]], {{.*}}DIFlagTypePassByValue
89 void L() {
90 auto func = [&]() {};
93 // Check that types are being added to retained types list.
94 // CHECK-DAG: !DICompileUnit{{.*}}retainedTypes: ![[RETAINED:[0-9]+]]
95 // CHECK-DAG: ![[RETAINED]] = {{.*}}![[C]]
98 struct VTableAndCtor {
99 virtual void f1();
100 VTableAndCtor();
103 VTableAndCtor::VTableAndCtor() {
106 // ITANIUM-DAG: !DICompositeType({{.*}}name: "VTableAndCtor", {{.*}}flags: DIFlagFwdDecl