File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed
llvm/lib/ProfileData/Coverage Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change 1+ // UNSUPPORTED: target={{.*windows.*}}
2+
3+ // clang-format off
4+ // RUN: split-file %s %t
5+ // RUN: %clangxx_profgen -fcoverage-mapping %t/test1.cpp -o %t/test1.exe
6+ // RUN: %clangxx_profgen -fcoverage-mapping %t/test2.cpp -o %t/test2.exe
7+ // RUN: env LLVM_PROFILE_FILE=%t/test1.profraw %run %t/test1.exe
8+ // RUN: env LLVM_PROFILE_FILE=%t/test2.profraw %run %t/test2.exe
9+ // RUN: llvm-profdata merge %t/test1.profraw %t/test2.profraw -o %t/merged.profdata
10+ // RUN: llvm-cov show -instr-profile=%t/merged.profdata -object %t/test1.exe %t/test2.exe | FileCheck %s
11+ // RUN: llvm-cov show -instr-profile=%t/merged.profdata -object %t/test2.exe %t/test1.exe | FileCheck %s
12+
13+ // CHECK: |struct Test {
14+ // CHECK-NEXT: 1| int getToTest() {
15+ // CHECK-NEXT: 2| for (int i = 0; i < 1; i++) {
16+ // CHECK-NEXT: 1| if (false) {
17+ // CHECK-NEXT: 0| return 1;
18+ // CHECK-NEXT: 0| }
19+ // CHECK-NEXT: 1| }
20+ // CHECK-NEXT: 1| if (true) {
21+ // CHECK-NEXT: 1| return 1;
22+ // CHECK-NEXT: 1| }
23+ // CHECK-NEXT: 0| return 1;
24+ // CHECK-NEXT: 1| }
25+ // CHECK-NEXT: |};
26+ // CHECK-NEXT: |
27+
28+ #--- test.h
29+ struct Test {
30+ int getToTest () {
31+ for (int i = 0 ; i < 1 ; i++) {
32+ if (false ) {
33+ return 1 ;
34+ }
35+ }
36+ if (true ) {
37+ return 1 ;
38+ }
39+ return 1 ;
40+ }
41+ };
42+
43+ #--- test1.cpp
44+ #include " test.h"
45+ int main () {
46+ Test t;
47+ t.getToTest ();
48+ return 0 ;
49+ }
50+
51+ #--- test2.cpp
52+ #include " test.h"
53+ int main () {
54+ return 0 ;
55+ }
Original file line number Diff line number Diff line change @@ -851,7 +851,7 @@ Error CoverageMapping::loadFunctionRecord(
851851 // won't (in which case we don't unintuitively report functions as uncovered
852852 // when they have non-zero counts in the profile).
853853 if (Record.MappingRegions .size () == 1 &&
854- Record.MappingRegions [0 ].Count .isZero () && Counts[ 0 ] > 0 )
854+ Record.MappingRegions [0 ].Count .isZero ())
855855 return Error::success ();
856856
857857 MCDCDecisionRecorder MCDCDecisions;
You can’t perform that action at this time.
0 commit comments