Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / microsoft-abi-vbase-dtor.cpp
blob8fc3f715fc6c0ebbbc9aed9df244992ec38de799
1 // RUN: %clang_cc1 -std=c++17 -emit-llvm %s -triple x86_64-windows-msvc -o - | FileCheck %s
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;
11 struct HasCompleteDtor : virtual DefaultedDtor {
12 ~HasCompleteDtor();
14 void useCompleteDtor(HasCompleteDtor *p) { delete p; }
16 // CHECK-LABEL: define dso_local void @"?useCompleteDtor@@YAXPEAUHasCompleteDtor@@@Z"(ptr noundef %p)
17 // CHECK: call void @"??_DHasCompleteDtor@@QEAAXXZ"({{.*}})
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"({{.*}})
23 // CHECK-LABEL: define linkonce_odr dso_local void @"??1DefaultedDtor@@QEAA@XZ"(ptr {{[^,]*}} %this)
24 // CHECK: call void @"??1HasDtor@@QEAA@XZ"(ptr {{[^,]*}} %{{.*}})