summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-09-25 00:34:18 +0000
committerJustin Bogner <mail@justinbogner.com>2014-09-25 00:34:18 +0000
commitb35a72ae9e7ee6e4cf583a1c19711518e6bf6933 (patch)
tree81153e8b5e6adb66a6df4b77a8e4c08c4988694a /llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp
parent8cc48bd159b0fb52c346e90c381ae96d5a59f72c (diff)
downloadbcm5719-llvm-b35a72ae9e7ee6e4cf583a1c19711518e6bf6933.tar.gz
bcm5719-llvm-b35a72ae9e7ee6e4cf583a1c19711518e6bf6933.zip
llvm-cov: Combine segments that cover the same location
If we have multiple coverage counts for the same segment, we need to add them up rather than arbitrarily choosing one. This fixes that and adds a test with template instantiations to exercise it. llvm-svn: 218432
Diffstat (limited to 'llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp')
-rw-r--r--llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp b/llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp
new file mode 100644
index 00000000000..2b72d83c013
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/showTemplateInstantiations.cpp
@@ -0,0 +1,43 @@
+// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -no-colors -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=ALL %s
+// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -no-colors -filename-equivalence -name=_Z4funcIbEiT_ %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s
+
+// before coverage // WHOLE-FILE: | [[@LINE]]|// before
+ // FILTER-NOT: | [[@LINE-1]]|// before
+template<typename T> // ALL: | [[@LINE]]|template<typename T>
+int func(T x) { // ALL-NEXT: 2| [[@LINE]]|int func(T x) {
+ if(x) // ALL-NEXT: 2| [[@LINE]]| if(x)
+ return 0; // ALL-NEXT: 1| [[@LINE]]| return 0;
+ else // ALL-NEXT: 1| [[@LINE]]| else
+ return 1; // ALL-NEXT: 1| [[@LINE]]| return 1;
+ int j = 1; // ALL-NEXT: 0| [[@LINE]]| int j = 1;
+} // ALL-NEXT: 1| [[@LINE]]|}
+
+ // CHECK: {{^ *(\| )?}}_Z4funcIbEiT_:
+ // CHECK-NEXT: 1| [[@LINE-9]]|int func(T x) {
+ // CHECK-NEXT: 1| [[@LINE-9]]| if(x)
+ // CHECK-NEXT: 1| [[@LINE-9]]| return 0;
+ // CHECK-NEXT: 1| [[@LINE-9]]| else
+ // CHECK-NEXT: 0| [[@LINE-9]]| return 1;
+ // CHECK-NEXT: 0| [[@LINE-9]]| int j = 1;
+ // CHECK-NEXT: 1| [[@LINE-9]]|}
+
+ // ALL: {{^ *}}| _Z4funcIiEiT_:
+ // FILTER-NOT: {{^ *(\| )?}} _Z4funcIiEiT_:
+ // ALL-NEXT: 1| [[@LINE-19]]|int func(T x) {
+ // ALL-NEXT: 1| [[@LINE-19]]| if(x)
+ // ALL-NEXT: 0| [[@LINE-19]]| return 0;
+ // ALL-NEXT: 1| [[@LINE-19]]| else
+ // ALL-NEXT: 1| [[@LINE-19]]| return 1;
+ // ALL-NEXT: 0| [[@LINE-19]]| int j = 1;
+ // ALL-NEXT: 1| [[@LINE-19]]|}
+
+int main() { // ALL: 1| [[@LINE]]|int main() {
+ func<int>(0); // ALL-NEXT: 1| [[@LINE]]| func<int>(0);
+ func<bool>(true); // ALL-NEXT: 1| [[@LINE]]| func<bool>(true);
+ return 0; // ALL-NEXT: 1| [[@LINE]]| return 0;
+} // ALL-NEXT: 1| [[@LINE]]|}
+// after coverage // ALL-NEXT: | [[@LINE]]|// after
+ // FILTER-NOT: | [[@LINE-1]]|// after
+
+// llvm-cov doesn't work on big endian yet
+// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc
OpenPOWER on IntegriCloud