1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[llvm-cov] Don't attach exec counts to lines which start a skipped region

These lines by definition don't have an execution count.

This is the final part of the fix for:
https://bugs.llvm.org/show_bug.cgi?id=34166

llvm-svn: 312955
This commit is contained in:
Vedant Kumar 2017-09-11 21:31:32 +00:00
parent beb219a85a
commit 37bb41602e
4 changed files with 23 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,16 @@
// RUN: llvm-cov show -instr-profile %S/Inputs/ifdef.profdata %S/Inputs/ifdef.covmapping -dump -path-equivalence=/tmp,%S %s > %t.out 2>&1
// RUN: FileCheck %s -input-file %t.out -check-prefix=LINE
// RUN: FileCheck %s -input-file %t.out -check-prefix=HIGHLIGHT
int main() {
if (0) { // LINE: [[@LINE]]|{{ +}}1|
#if 0 // LINE-NEXT: [[@LINE]]|{{ +}}|
#endif // LINE-NEXT: [[@LINE]]|{{ +}}|
}
return 0;
}
// HIGHLIGHT: Highlighted line [[@LINE-7]], 10 -> ?
// HIGHLIGHT-NEXT: Highlighted line [[@LINE-7]], 1 -> 1
// HIGHLIGHT-NEXT: Highlighted line [[@LINE-6]], 1 -> 4

View File

@ -95,9 +95,15 @@ LineCoverageStats::LineCoverageStats(
if (isStartOfRegion(LineSegments[I]))
++MinRegionCount;
bool StartOfSkippedRegion = !LineSegments.empty() &&
!LineSegments.front()->HasCount &&
LineSegments.front()->IsRegionEntry;
ExecutionCount = 0;
HasMultipleRegions = MinRegionCount > 1;
Mapped = (WrappedSegment && WrappedSegment->HasCount) || (MinRegionCount > 0);
Mapped =
!StartOfSkippedRegion &&
((WrappedSegment && WrappedSegment->HasCount) || (MinRegionCount > 0));
if (!Mapped)
return;