summaryrefslogtreecommitdiffstats
path: root/clang/test/Profile/cxx-virtual-destructor-calls.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2015-05-20 16:16:23 +0000
committerJustin Bogner <mail@justinbogner.com>2015-05-20 16:16:23 +0000
commitfb29822bf41d6dab9d8d3a4266c44a3d4b3f6d68 (patch)
treea170cbf6ab741da6bdfacd9c5a401dbaa188d948 /clang/test/Profile/cxx-virtual-destructor-calls.cpp
parentfd27a1dc1b842273dff73b57bb66ed449e6133c4 (diff)
downloadbcm5719-llvm-fb29822bf41d6dab9d8d3a4266c44a3d4b3f6d68.tar.gz
bcm5719-llvm-fb29822bf41d6dab9d8d3a4266c44a3d4b3f6d68.zip
InstrProf: Increment the profile counter for all types of destructor
-fprofile-instr-generate does not emit counter increment intrinsics for Dtor_Deleting and Dtor_Complete destructors with assigned counters. This causes unnecessary [-Wprofile-instr-out-of-date] warnings during profile-use runs even if the source has never been modified since profile collection. Patch by Betul Buyukkurt. Thanks! llvm-svn: 237804
Diffstat (limited to 'clang/test/Profile/cxx-virtual-destructor-calls.cpp')
-rw-r--r--clang/test/Profile/cxx-virtual-destructor-calls.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/Profile/cxx-virtual-destructor-calls.cpp b/clang/test/Profile/cxx-virtual-destructor-calls.cpp
new file mode 100644
index 00000000000..559a1bf93f4
--- /dev/null
+++ b/clang/test/Profile/cxx-virtual-destructor-calls.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -main-file-name cxx-virtual-destructor-calls.cpp %s -o - -fprofile-instr-generate | FileCheck %s
+
+struct Member {
+ ~Member();
+};
+
+struct A {
+ virtual ~A();
+};
+
+struct B : A {
+ Member m;
+ virtual ~B();
+};
+
+// Complete dtor
+// CHECK: @__llvm_profile_name__ZN1BD1Ev = private constant [9 x i8] c"_ZN1BD1Ev", section "__DATA,__llvm_prf_names", align 1
+
+// Deleting dtor
+// CHECK: @__llvm_profile_name__ZN1BD0Ev = private constant [9 x i8] c"_ZN1BD0Ev", section "__DATA,__llvm_prf_names", align 1
+
+// Complete dtor counters and profile data
+// CHECK: @__llvm_profile_counters__ZN1BD1Ev = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
+// CHECK: @__llvm_profile_data__ZN1BD1Ev =
+
+// Deleting dtor counters and profile data
+// CHECK: @__llvm_profile_counters__ZN1BD0Ev = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
+// CHECK: @__llvm_profile_data__ZN1BD0Ev =
+
+B::~B() { }
OpenPOWER on IntegriCloud