| 1 |
// RUN: %clang_cc1 -std=c++17 -emit-llvm %s -triple x86_64-windows-msvc -o - | FileCheck %s |
| 2 |
|
| 3 |
// Make sure virtual base base destructors get referenced and emitted if |
| 4 |
// necessary when the complete ("vbase") destructor is emitted. In this case, |
| 5 |
// clang previously did not emit ~DefaultedDtor. |
| 6 |
struct HasDtor { ~HasDtor(); }; |
| 7 |
struct DefaultedDtor { |
| 8 |
~DefaultedDtor() = default; |
| 9 |
HasDtor o; |
| 10 |
}; |
| 11 |
struct HasCompleteDtor : virtual DefaultedDtor { |
| 12 |
~HasCompleteDtor(); |
| 13 |
}; |
| 14 |
void useCompleteDtor(HasCompleteDtor *p) { delete p; } |
| 15 |
|
| 16 |
// CHECK-LABEL: define dso_local void @"?useCompleteDtor@@YAXPEAUHasCompleteDtor@@@Z"(ptr noundef %p) |
| 17 |
// CHECK: call void @"??_DHasCompleteDtor@@QEAAXXZ"({{.*}}) |
| 18 |
|
| 19 |
// CHECK-LABEL: define linkonce_odr dso_local void @"??_DHasCompleteDtor@@QEAAXXZ"(ptr {{[^,]*}} %this) |
| 20 |
// CHECK: call void @"??1HasCompleteDtor@@QEAA@XZ"({{.*}}) |
| 21 |
// CHECK: call void @"??1DefaultedDtor@@QEAA@XZ"({{.*}}) |
| 22 |
|
| 23 |
// CHECK-LABEL: define linkonce_odr dso_local void @"??1DefaultedDtor@@QEAA@XZ"(ptr {{[^,]*}} %this) |
| 24 |
// CHECK: call void @"??1HasDtor@@QEAA@XZ"(ptr {{[^,]*}} %{{.*}}) |
| 25 |
|