Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / dllimport-dtor-thunks.cpp
blob1cad5c93dc27e47241067b06587ab00f6a949dcd
1 // RUN: %clang_cc1 -mconstructor-aliases %s -triple x86_64-windows-msvc -fms-extensions -emit-llvm -o - | FileCheck %s
3 // PR32990
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 };
11 struct BaseClass {
12 virtual ~BaseClass() {}
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() {}
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() {}
30 extern "C" void testit() {
31 ImportIntroVDtor t1;
32 ImportOverrideVDtor t2;
33 ImportVBaseOverrideVDtor t3;
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 {{[^,]*}} %{{.*}})
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"