Clang Project

clang_source_code/test/CodeGenCXX/debug-info-composite-cc.cpp
1// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -triple %itanium_abi_triple %s -o - | FileCheck %s
2
3// Not trivially copyable because of the explicit destructor.
4// CHECK-DAG: !DICompositeType({{.*}}, name: "RefDtor",{{.*}}flags: DIFlagTypePassByReference
5struct RefDtor {
6  int i;
7  ~RefDtor() {}
8} refDtor;
9
10// Not trivially copyable because of the explicit copy constructor.
11// CHECK-DAG: !DICompositeType({{.*}}, name: "RefCopy",{{.*}}flags: DIFlagTypePassByReference
12struct RefCopy {
13  int i;
14  RefCopy() = default;
15  RefCopy(RefCopy &Copy) {}
16} refCopy;
17
18// POD-like type even though it defines a destructor.
19// CHECK-DAG: !DICompositeType({{.*}}, name: "Podlike", {{.*}}flags: DIFlagTypePassByValue
20struct Podlike {
21  int i;
22  Podlike() = default;
23  Podlike(Podlike &&Move) = default;
24  ~Podlike() = default;
25} podlike;
26
27
28// This is a POD type.
29// CHECK-DAG: !DICompositeType({{.*}}, name: "Pod",{{.*}}flags: DIFlagTypePassByValue
30struct Pod {
31  int i;
32} pod;
33
34// This is definitely not a POD type.
35// CHECK-DAG: !DICompositeType({{.*}}, name: "Complex",{{.*}}flags: DIFlagTypePassByReference
36struct Complex {
37  Complex() {}
38  Complex(Complex &Copy) : i(Copy.i) {};
39  int i;
40} complex;
41
42// This type is manually marked as trivial_abi.
43// CHECK-DAG: !DICompositeType({{.*}}, name: "Marked",{{.*}}flags: DIFlagTypePassByValue
44struct __attribute__((trivial_abi)) Marked {
45  int *p;
46  Marked();
47  ~Marked();
48  Marked(const Marked &) noexcept;
49  Marked &operator=(const Marked &);
50} marked;
51