mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[llvm-cov] reset executation count to 0 after wrapped segment
Fix the bug: https://bugs.llvm.org/show_bug.cgi?id=36979. It also fixes this bug: https://bugs.llvm.org/show_bug.cgi?id=35404, which I think is caused by the same problem. Differential Revision: https://reviews.llvm.org/D85036
This commit is contained in:
parent
a4ce31d13f
commit
425e233cb4
@ -770,6 +770,7 @@ LineCoverageStats::LineCoverageStats(
|
||||
ExecutionCount = WrappedSegment->Count;
|
||||
if (!MinRegionCount)
|
||||
return;
|
||||
ExecutionCount = 0;
|
||||
for (const auto *LS : LineSegments)
|
||||
if (isStartOfRegion(LS))
|
||||
ExecutionCount = std::max(ExecutionCount, LS->Count);
|
||||
|
@ -12,7 +12,7 @@ template <class T> T FOO<T>::DoIt(T ti) { // HEADER: [[@LINE]]| 2|template
|
||||
for (T I = 0; I < ti; I++) { // HEADER: [[@LINE]]| 22| for (T
|
||||
t += I; // HEADER: [[@LINE]]| 20| t += I;
|
||||
if (I > ti / 2) // HEADER: [[@LINE]]| 20| if (I > ti
|
||||
t -= 1; // HEADER: [[@LINE]]| 20| t -= 1;
|
||||
t -= 1; // HEADER: [[@LINE]]| 8| t -= 1;
|
||||
} // HEADER: [[@LINE]]| 20| }
|
||||
// HEADER: [[@LINE]]| 2|
|
||||
return t; // HEADER: [[@LINE]]| 2| return t;
|
||||
|
@ -22,7 +22,7 @@ REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
|
||||
REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
|
||||
REPORT_IGNORE_DIR: {{.*}}abs.h{{.*}}
|
||||
REPORT_IGNORE_DIR: {{.*}}main.cc{{.*}}
|
||||
REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}100.00%{{$}}
|
||||
REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}90.00%{{$}}
|
||||
|
||||
# Ignore all files from "extra" directory even when SOURCES specified.
|
||||
RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
|
||||
@ -35,7 +35,7 @@ REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
|
||||
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
|
||||
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}main.cc{{.*}}
|
||||
REPORT_IGNORE_DIR_WITH_SOURCES: {{.*}}abs.h{{.*}}
|
||||
REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}100.00%{{$}}
|
||||
REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}80.00%{{$}}
|
||||
|
||||
########################
|
||||
# Test "show" command.
|
||||
|
@ -675,7 +675,7 @@ TEST_P(CoverageMappingTest, test_line_coverage_iterator) {
|
||||
CoverageData Data = LoadedCoverage->getCoverageForFile("file1");
|
||||
|
||||
unsigned Line = 0;
|
||||
unsigned LineCounts[] = {20, 20, 20, 20, 30, 10, 10, 10, 10, 0, 0};
|
||||
unsigned LineCounts[] = {20, 20, 20, 20, 10, 10, 10, 10, 10, 0, 0};
|
||||
for (const auto &LCS : getLineCoverageStats(Data)) {
|
||||
ASSERT_EQ(Line + 1, LCS.getLine());
|
||||
errs() << "Line: " << Line + 1 << ", count = " << LCS.getExecutionCount() << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user