brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 18adfde Raw
108 lines · cpp
1// RUN: %clang_cc1 -debug-info-kind=constructor -emit-llvm %s -o - | FileCheck %s2// RUN: %clang_cc1 -debug-info-kind=constructor -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix=CHECK --check-prefix=ITANIUM %s3 4// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "A"{{.*}}DIFlagTypePassByValue5struct A {6} TestA;7 8// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "B"{{.*}}flags: DIFlagFwdDecl9struct B {10  B();11} TestB;12 13// CHECK-DAG: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C"{{.*}}DIFlagTypePassByValue14struct C {15  C() {}16} TestC;17 18// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "D"{{.*}}DIFlagTypePassByValue19struct D {20  D();21};22D::D() {}23 24// Test for constexpr constructor.25// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "E"{{.*}}DIFlagTypePassByValue26struct E {27  constexpr E(){};28} TestE;29 30// Test for trivial constructor.31// CHECK-DAG: !DICompositeType(tag: DW_TAG_structure_type, name: "F"{{.*}}DIFlagTypePassByValue32struct F {33  F() = default;34  F(int) {}35  int i;36} TestF;37 38// Test for trivial constructor.39// CHECK-DAG: ![[G:.*]] ={{.*}}!DICompositeType({{.*}}name: "G"{{.*}}DIFlagTypePassByValue40// CHECK-DAG: !DICompositeType({{.*}}scope: ![[G]], {{.*}}DIFlagTypePassByValue41struct G {42  G() : g_(0) {}43  struct {44    int g_;45  };46} TestG;47 48// Test for an aggregate class with an implicit non-trivial default constructor49// that is not instantiated.50// CHECK-DAG: !DICompositeType({{.*}}name: "H",{{.*}}DIFlagTypePassByValue51struct H {52  B b;53};54void f(H h) {}55 56// Test for an aggregate class with an implicit non-trivial default constructor57// that is instantiated.58// CHECK-DAG: !DICompositeType({{.*}}name: "J",{{.*}}DIFlagTypePassByValue59struct J {60  B b;61};62void f(decltype(J()) j) {}63 64// Test for a class with trivial default constructor that is not instantiated.65// CHECK-DAG: !DICompositeType({{.*}}name: "K",{{.*}}DIFlagTypePassByValue66class K {67  int i;68};69void f(K k) {}70 71// CHECK-DAG: !DICompositeType({{.*}}name: "DeletedCtors",{{.*}}DIFlagTypePassBy72struct NonTrivial {73  NonTrivial();74};75struct DeletedCtors {76  DeletedCtors() = delete;77  DeletedCtors(const DeletedCtors &) = default;78  void f1();79  NonTrivial t;80};81 82const NonTrivial &f(const DeletedCtors &D) {83  return D.t;84}85 86// Test that we don't use constructor homing on lambdas.87// CHECK-DAG: ![[L:.*]] ={{.*}}!DISubprogram({{.*}}name: "L"88// CHECK-DAG: !DICompositeType({{.*}}scope: ![[L]], {{.*}}DIFlagTypePassByValue89void L() {90  auto func = [&]() {};91}92 93// Check that types are being added to retained types list.94// CHECK-DAG: !DICompileUnit{{.*}}retainedTypes: ![[RETAINED:[0-9]+]]95// CHECK-DAG: ![[RETAINED]] = {{.*}}![[C]]96 97 98struct VTableAndCtor {99  virtual void f1();100  VTableAndCtor();101};102 103VTableAndCtor::VTableAndCtor() {104}105 106// ITANIUM-DAG: !DICompositeType({{.*}}name: "VTableAndCtor", {{.*}}flags: DIFlagFwdDecl107 108