| 1 |
// Tests that we emit unified constructor/destructor linkage names |
| 2 |
// for ABIs that support it. |
| 3 |
|
| 4 |
// Check that -gstructor-decl-linkage-names is the default. |
| 5 |
// RUN: %clang_cc1 -triple aarch64-apple-macosx -emit-llvm -debug-info-kind=standalone \ |
| 6 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,ITANIUM |
| 7 |
// |
| 8 |
// Check with -gstructor-decl-linkage-names. |
| 9 |
// RUN: %clang_cc1 -triple aarch64-apple-macosx -emit-llvm -debug-info-kind=standalone \ |
| 10 |
// RUN: -gstructor-decl-linkage-names %s -o - | FileCheck %s --check-prefixes=CHECK,ITANIUM |
| 11 |
// |
| 12 |
// Check with -gno-structor-decl-linkage-names. |
| 13 |
// RUN: %clang_cc1 -triple aarch64-apple-macosx -emit-llvm -debug-info-kind=standalone \ |
| 14 |
// RUN: -gno-structor-decl-linkage-names %s -o - | FileCheck %s --check-prefixes=CHECK,DISABLE |
| 15 |
// |
| 16 |
// Check ABI without structor variants. |
| 17 |
// RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -debug-info-kind=standalone \ |
| 18 |
// RUN: -gstructor-decl-linkage-names %s -o - | FileCheck %s --check-prefixes=CHECK,MSABI |
| 19 |
|
| 20 |
struct Base { |
| 21 |
Base(int x); |
| 22 |
~Base(); |
| 23 |
}; |
| 24 |
|
| 25 |
Base::Base(int x) {} |
| 26 |
Base::~Base() {} |
| 27 |
|
| 28 |
// Check that we emit unified ctor/dtor (C4/D4) on Itanium but not for MS-ABI. |
| 29 |
|
| 30 |
// CHECK: ![[BASE_CTOR_DECL:[0-9]+]] = !DISubprogram(name: "Base" |
| 31 |
// MSABI-NOT: linkageName: |
| 32 |
// DISABLE-NOT: linkageName: |
| 33 |
// ITANIUM-SAME: linkageName: "_ZN4BaseC4Ei" |
| 34 |
// CHECK-SAME: spFlags: 0 |
| 35 |
|
| 36 |
// CHECK: ![[BASE_DTOR_DECL:[0-9]+]] = !DISubprogram(name: "~Base" |
| 37 |
// MSABI-NOT: linkageName: |
| 38 |
// DISABLE-NOT: linkageName: |
| 39 |
// ITANIUM-SAME: linkageName: "_ZN4BaseD4Ev" |
| 40 |
// CHECK-SAME: spFlags: 0 |
| 41 |
|
| 42 |
// Check that the ctor/dtor definitions have linkage names that aren't |
| 43 |
// the ones on the declaration. |
| 44 |
|
| 45 |
// CHECK: !DISubprogram(name: "Base" |
| 46 |
// MSABI-SAME: linkageName: |
| 47 |
// ITANIUM-SAME: linkageName: "_ZN4BaseC2Ei" |
| 48 |
// CHECK-SAME: spFlags: DISPFlagDefinition |
| 49 |
// CHECK-SAME: declaration: ![[BASE_CTOR_DECL]] |
| 50 |
|
| 51 |
// ITANIUM: !DISubprogram(name: "Base" |
| 52 |
// ITANIUM-SAME: linkageName: "_ZN4BaseC1Ei" |
| 53 |
// ITANIUM-SAME: spFlags: DISPFlagDefinition |
| 54 |
// ITANIUM-SAME: declaration: ![[BASE_CTOR_DECL]] |
| 55 |
|
| 56 |
// CHECK: !DISubprogram(name: "~Base" |
| 57 |
// MSABI-SAME: linkageName: |
| 58 |
// ITANIUM-SAME: linkageName: "_ZN4BaseD2Ev" |
| 59 |
// CHECK-SAME: spFlags: DISPFlagDefinition |
| 60 |
// CHECK-SAME: declaration: ![[BASE_DTOR_DECL]] |
| 61 |
|
| 62 |
// ITANIUM: !DISubprogram(name: "~Base" |
| 63 |
// ITANIUM-SAME: linkageName: "_ZN4BaseD1Ev" |
| 64 |
// ITANIUM-SAME: spFlags: DISPFlagDefinition |
| 65 |
// ITANIUM-SAME: declaration: ![[BASE_DTOR_DECL]] |
| 66 |
|
| 67 |
struct Derived : public Base { |
| 68 |
using Base::Base; |
| 69 |
} d(5); |
| 70 |
|
| 71 |
// CHECK: !DISubprogram(name: "Base" |
| 72 |
// MSABI-SAME: linkageName: |
| 73 |
// ITANIUM-SAME: linkageName: "_ZN7DerivedCI14BaseEi" |
| 74 |
// CHECK-SAME: spFlags: {{.*}}DISPFlagDefinition |
| 75 |
// CHECK-SAME: declaration: ![[BASE_INHERIT_CTOR_DECL:[0-9]+]] |
| 76 |
|
| 77 |
// CHECK: [[BASE_INHERIT_CTOR_DECL]] = !DISubprogram(name: "Base" |
| 78 |
// MSABI-NOT: linkageName: |
| 79 |
// DISABLE-NOT: linkageName: |
| 80 |
// ITANIUM-SAME: linkageName: "_ZN7DerivedCI44BaseEi" |
| 81 |
// CHECK-SAME spFlags: 0 |
| 82 |
|
| 83 |
// ITANIUM: !DISubprogram(name: "Base" |
| 84 |
// ITANIUM-SAME: linkageName: "_ZN7DerivedCI24BaseEi" |
| 85 |
// ITANIUM-SAME: spFlags: DISPFlagDefinition |
| 86 |
// ITANIUM-SAME: declaration: ![[BASE_INHERIT_CTOR_DECL:[0-9]+]] |
| 87 |
|
| 88 |
// MSABI: !DISubprogram(name: "~Derived" |
| 89 |
// DISABLE: !DISubprogram(name: "~Derived" |