| 1 |
// RUN: %clang_cc1 -mconstructor-aliases %s -triple x86_64-windows-msvc -fms-extensions -emit-llvm -o - | FileCheck %s |
| 2 |
|
| 3 |
// PR32990 |
| 4 |
|
| 5 |
// Introduces the virtual destructor. We should use the base destructor |
| 6 |
// directly, no thunk needed. |
| 7 |
struct __declspec(dllimport) ImportIntroVDtor { |
| 8 |
virtual ~ImportIntroVDtor() {} |
| 9 |
}; |
| 10 |
|
| 11 |
struct BaseClass { |
| 12 |
virtual ~BaseClass() {} |
| 13 |
}; |
| 14 |
|
| 15 |
// Non-virtually inherits from a non-dllimport base class. We should again call |
| 16 |
// the derived base constructor directly. No need for the complete (aka vbase) |
| 17 |
// destructor. |
| 18 |
struct __declspec(dllimport) ImportOverrideVDtor : public BaseClass { |
| 19 |
virtual ~ImportOverrideVDtor() {} |
| 20 |
}; |
| 21 |
|
| 22 |
// Virtually inherits from a non-dllimport base class. In this case, we can |
| 23 |
// expect the DLL to provide a definition of the complete dtor. See |
| 24 |
// dllexport-dtor-thunks.cpp. |
| 25 |
struct __declspec(dllimport) ImportVBaseOverrideVDtor |
| 26 |
: public virtual BaseClass { |
| 27 |
virtual ~ImportVBaseOverrideVDtor() {} |
| 28 |
}; |
| 29 |
|
| 30 |
extern "C" void testit() { |
| 31 |
ImportIntroVDtor t1; |
| 32 |
ImportOverrideVDtor t2; |
| 33 |
ImportVBaseOverrideVDtor t3; |
| 34 |
} |
| 35 |
|
| 36 |
// The destructors are called in reverse order of construction. Only the third |
| 37 |
// needs the complete destructor (_D). |
| 38 |
// CHECK-LABEL: define dso_local void @testit() |
| 39 |
// CHECK: call void @"??_DImportVBaseOverrideVDtor@@QEAAXXZ"(ptr {{[^,]*}} %{{.*}}) |
| 40 |
// CHECK: call void @"??1ImportOverrideVDtor@@UEAA@XZ"(ptr {{[^,]*}} %{{.*}}) |
| 41 |
// CHECK: call void @"??1ImportIntroVDtor@@UEAA@XZ"(ptr {{[^,]*}} %{{.*}}) |
| 42 |
|
| 43 |
// CHECK-LABEL: declare dllimport void @"??_DImportVBaseOverrideVDtor@@QEAAXXZ" |
| 44 |
// CHECK-LABEL: declare dllimport void @"??1ImportOverrideVDtor@@UEAA@XZ" |
| 45 |
// CHECK-LABEL: declare dllimport void @"??1ImportIntroVDtor@@UEAA@XZ" |