Adrian Prantl | 6c5f03a | 2018-01-05 01:13:52 +0000 | [diff] [blame] | 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 |
| 5 | struct 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 |
| 12 | struct RefCopy { |
| 13 | int i; |
| 14 | RefCopy() = default; |
| 15 | RefCopy(RefCopy &Copy) {} |
| 16 | } refCopy; |
| 17 | |
Adrian Prantl | 6c5f03a | 2018-01-05 01:13:52 +0000 | [diff] [blame] | 18 | // POD-like type even though it defines a destructor. |
| 19 | // CHECK-DAG: !DICompositeType({{.*}}, name: "Podlike", {{.*}}flags: DIFlagTypePassByValue |
| 20 | struct 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 |
| 30 | struct Pod { |
| 31 | int i; |
| 32 | } pod; |
| 33 | |
| 34 | // This is definitely not a POD type. |
| 35 | // CHECK-DAG: !DICompositeType({{.*}}, name: "Complex",{{.*}}flags: DIFlagTypePassByReference |
| 36 | struct Complex { |
| 37 | Complex() {} |
| 38 | Complex(Complex &Copy) : i(Copy.i) {}; |
| 39 | int i; |
| 40 | } complex; |
Adrian Prantl | 69fce12 | 2018-03-08 23:11:46 +0000 | [diff] [blame] | 41 | |
| 42 | // This type is manually marked as trivial_abi. |
| 43 | // CHECK-DAG: !DICompositeType({{.*}}, name: "Marked",{{.*}}flags: DIFlagTypePassByValue |
| 44 | struct __attribute__((trivial_abi)) Marked { |
| 45 | int *p; |
| 46 | Marked(); |
| 47 | ~Marked(); |
| 48 | Marked(const Marked &) noexcept; |
| 49 | Marked &operator=(const Marked &); |
| 50 | } marked; |