summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmappingbin0 -> 331 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp15
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext26
-rw-r--r--llvm/test/tools/llvm-cov/lit.local.cfg2
-rw-r--r--llvm/test/tools/llvm-cov/prevent_false_instantiations.h10
5 files changed, 52 insertions, 1 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping
new file mode 100644
index 00000000000..cfa4e295d36
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.covmapping
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp
new file mode 100644
index 00000000000..2a84f1dd58e
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.cpp
@@ -0,0 +1,15 @@
+#include "prevent_false_instantiations.h"
+
+void func1() {
+ DO_SOMETHING();
+}
+
+void func2() {
+ DO_SOMETHING();
+}
+
+int main() {
+ func1();
+ func2();
+ return 0;
+}
diff --git a/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext
new file mode 100644
index 00000000000..ad5362e17e4
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/prevent_false_instantiations.proftext
@@ -0,0 +1,26 @@
+_Z5func1v
+# Func Hash:
+3
+# Num Counters:
+2
+# Counter Values:
+1
+0
+
+_Z5func2v
+# Func Hash:
+3
+# Num Counters:
+2
+# Counter Values:
+1
+0
+
+main
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+1
+
diff --git a/llvm/test/tools/llvm-cov/lit.local.cfg b/llvm/test/tools/llvm-cov/lit.local.cfg
index 05aef8645e4..8b6fe62772f 100644
--- a/llvm/test/tools/llvm-cov/lit.local.cfg
+++ b/llvm/test/tools/llvm-cov/lit.local.cfg
@@ -1 +1 @@
-config.suffixes = ['.test', '.m', '.cpp', '.c']
+config.suffixes = ['.test', '.m', '.cpp', '.c', '.h']
diff --git a/llvm/test/tools/llvm-cov/prevent_false_instantiations.h b/llvm/test/tools/llvm-cov/prevent_false_instantiations.h
new file mode 100644
index 00000000000..667ebde6d16
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/prevent_false_instantiations.h
@@ -0,0 +1,10 @@
+// Checks that function instantiations don't go to a wrong file.
+
+// CHECK-NOT: {{_Z5func[1,2]v}}
+
+// RUN: llvm-profdata merge %S/Inputs/prevent_false_instantiations.proftext -o %t.profdata
+// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s
+
+#define DO_SOMETHING() \
+ do { \
+ } while (0)
OpenPOWER on IntegriCloud