Debian Codegraph @

clang/test/Profile/cxx-abc-deleting-dtor.cpp

raw
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=MSVC
4 // 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=LINUX
7
8 // Check that clang doesn't emit counters or __profn_ variables for deleting
9 // destructor variants in both C++ ABIs.
10
11 struct ABC {
12 virtual ~ABC() = default;
13 virtual void pure() = 0;
14 };
15 struct DerivedABC : ABC {
16 ~DerivedABC() override = default;
17 void pure() override {}
18 };
19 DerivedABC *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 @"??_GABC@@UEAAPEAXI@Z"(ptr {{[^,]*}} %this, {{.*}})
28 // MSVC-NOT: call void @llvm.instrprof.increment({{.*}})
29 // MSVC: call void @llvm.trap()
30 // MSVC-NEXT: unreachable
31
32 // MSVC-LABEL: define linkonce_odr dso_local noundef ptr @"??_GDerivedABC@@UEAAPEAXI@Z"(ptr {{[^,]*}} %this, {{.*}})
33 // MSVC-NOT: call void @llvm.instrprof.increment({{.*}})
34 // MSVC: call void @"??1DerivedABC@@UEAA@XZ"({{.*}})
35
36 // MSVC-LABEL: define linkonce_odr dso_local void @"??1DerivedABC@@UEAA@XZ"({{.*}})
37 // MSVC: call void @llvm.instrprof.increment({{.*}})
38 // MSVC: call void @"??1ABC@@UEAA@XZ"({{.*}})
39 // MSVC: ret void
40
41 // MSVC-LABEL: define linkonce_odr dso_local void @"??1ABC@@UEAA@XZ"({{.*}})
42 // MSVC: call void @llvm.instrprof.increment({{.*}})
43 // MSVC: ret void
44
45
46 // D2 is the base, D1 and D0 are deleting and complete dtors.
47
48 // LINUX-NOT: @__profn_{{.*D[01]Ev}} =
49 // LINUX: @__profn__ZN10DerivedABCD2Ev =
50 // LINUX-NOT: @__profn_{{.*D[01]Ev}} =
51 // LINUX: @__profn__ZN3ABCD2Ev =
52 // LINUX-NOT: @__profn_{{.*D[01]Ev}} =
53
54 // LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD1Ev(ptr {{[^,]*}} %this)
55 // LINUX-NOT: call void @llvm.instrprof.increment({{.*}})
56 // LINUX: call void @_ZN10DerivedABCD2Ev({{.*}})
57 // LINUX: ret void
58
59 // LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD0Ev(ptr {{[^,]*}} %this)
60 // LINUX-NOT: call void @llvm.instrprof.increment({{.*}})
61 // LINUX: call void @_ZN10DerivedABCD1Ev({{.*}})
62 // LINUX: call void @_ZdlPv({{.*}})
63 // LINUX: ret void
64
65 // LINUX-LABEL: define linkonce_odr void @_ZN3ABCD1Ev(ptr {{[^,]*}} %this)
66 // LINUX-NOT: call void @llvm.instrprof.increment({{.*}})
67 // LINUX: call void @llvm.trap()
68 // LINUX-NEXT: unreachable
69
70 // LINUX-LABEL: define linkonce_odr void @_ZN3ABCD0Ev(ptr {{[^,]*}} %this)
71 // LINUX-NOT: call void @llvm.instrprof.increment({{.*}})
72 // LINUX: call void @llvm.trap()
73 // LINUX-NEXT: unreachable
74
75 // LINUX-LABEL: define linkonce_odr void @_ZN10DerivedABCD2Ev(ptr {{[^,]*}} %this)
76 // LINUX: call void @llvm.instrprof.increment({{.*}})
77 // LINUX: call void @_ZN3ABCD2Ev({{.*}})
78 // LINUX: ret void
79
80 // LINUX-LABEL: define linkonce_odr void @_ZN3ABCD2Ev(ptr {{[^,]*}} %this)
81 // LINUX: call void @llvm.instrprof.increment({{.*}})
82 // LINUX: ret void