84 lines · cpp
1// RUN: %clang_cc1 -emit-llvm %s -std=c++11 -o - -fno-rtti \2// RUN: -fprofile-instrument=clang -fcoverage-mapping -disable-llvm-passes \3// RUN: -triple=x86_64-windows-msvc | FileCheck %s --check-prefix=MSVC4// RUN: %clang_cc1 -emit-llvm %s -std=c++11 -o - -fno-rtti \5// RUN: -fprofile-instrument=clang -fcoverage-mapping -disable-llvm-passes \6// RUN: -triple=x86_64-linux-gnu | FileCheck %s --check-prefix=LINUX7 8// Check that clang doesn't emit counters or __profn_ variables for deleting9// destructor variants in both C++ ABIs.10 11struct ABC {12 virtual ~ABC() = default;13 virtual void pure() = 0;14};15struct DerivedABC : ABC {16 ~DerivedABC() override = default;17 void pure() override {}18};19DerivedABC *useABCVTable() { return new DerivedABC(); }20 21// MSVC-NOT: @"__profn_??_G{{.*}}" =22// MSVC: @"__profn_??1DerivedABC@@{{.*}}" =23// MSVC-NOT: @"__profn_??_G{{.*}}" =24// MSVC: @"__profn_??1ABC@@{{.*}}" =25// MSVC-NOT: @"__profn_??_G{{.*}}" =26 27// MSVC-LABEL: define linkonce_odr dso_local noundef ptr @"??_GDerivedABC@@UEAAPEAXI@Z"(ptr {{[^,]*}} %this, {{.*}})28// MSVC-NOT: call void @llvm.instrprof.increment({{.*}})29// MSVC: call void @"??1DerivedABC@@UEAA@XZ"({{.*}})30// MSVC: ret void31 32// MSVC-LABEL: define linkonce_odr dso_local noundef ptr @"??_GABC@@UEAAPEAXI@Z"(ptr {{[^,]*}} %this, {{.*}})33// MSVC-NOT: call void @llvm.instrprof.increment({{.*}})34// MSVC: call void @llvm.trap()35// MSVC-NEXT: unreachable36 37// MSVC-LABEL: define linkonce_odr dso_local void @"??1DerivedABC@@UEAA@XZ"({{.*}})38// MSVC: call void @llvm.instrprof.increment({{.*}})39// MSVC: call void @"??1ABC@@UEAA@XZ"({{.*}})40// MSVC: ret void41 42// MSVC-LABEL: define linkonce_odr dso_local void @"??1ABC@@UEAA@XZ"({{.*}})43// MSVC: call void @llvm.instrprof.increment({{.*}})44// MSVC: ret void45 46 47// D2 is the base, D1 and D0 are deleting and complete dtors.48 49// LINUX-NOT: @__profn_{{.*D[01]Ev}} =50// LINUX: @__profn__ZN10DerivedABCD2Ev =51// LINUX-NOT: @__profn_{{.*D[01]Ev}} =52// LINUX: @__profn__ZN3ABCD2Ev =53// LINUX-NOT: @__profn_{{.*D[01]Ev}} =54 55// LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD1Ev(ptr {{[^,]*}} %this)56// LINUX-NOT: call void @llvm.instrprof.increment({{.*}})57// LINUX: call void @_ZN10DerivedABCD2Ev({{.*}})58// LINUX: ret void59 60// LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD0Ev(ptr {{[^,]*}} %this)61// LINUX-NOT: call void @llvm.instrprof.increment({{.*}})62// LINUX: call void @_ZN10DerivedABCD1Ev({{.*}})63// LINUX: call void @_ZdlPv({{.*}})64// LINUX: ret void65 66// LINUX-LABEL: define linkonce_odr void @_ZN3ABCD1Ev(ptr {{[^,]*}} %this)67// LINUX-NOT: call void @llvm.instrprof.increment({{.*}})68// LINUX: call void @llvm.trap()69// LINUX-NEXT: unreachable70 71// LINUX-LABEL: define linkonce_odr void @_ZN3ABCD0Ev(ptr {{[^,]*}} %this)72// LINUX-NOT: call void @llvm.instrprof.increment({{.*}})73// LINUX: call void @llvm.trap()74// LINUX-NEXT: unreachable75 76// LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD2Ev(ptr {{[^,]*}} %this)77// LINUX: call void @llvm.instrprof.increment({{.*}})78// LINUX: call void @_ZN3ABCD2Ev({{.*}})79// LINUX: ret void80 81// LINUX-LABEL: define linkonce_odr void @_ZN3ABCD2Ev(ptr {{[^,]*}} %this)82// LINUX: call void @llvm.instrprof.increment({{.*}})83// LINUX: ret void84