mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
llvm-cov: Fix an issue with showing regions but not counts
In r217746, though it was supposed to be NFC, I broke llvm-cov's handling of showing regions without showing counts. This should've shown up in the existing tests, except they were checking debug output that was displayed regardless of what was actually output. I've moved the relevant debug output to a more appropriate place so that the tests catch this kind of thing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217835 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d41a46e942
commit
47a75481e2
@ -1,4 +1,4 @@
|
|||||||
// RUN: llvm-cov show %S/Inputs/regionMarkers.covmapping -instr-profile %S/Inputs/regionMarkers.profdata -show-regions -dump -filename-equivalence %s | FileCheck %s
|
// RUN: llvm-cov show %S/Inputs/regionMarkers.covmapping -instr-profile %S/Inputs/regionMarkers.profdata -show-regions -dump -filename-equivalence %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
int main() { // CHECK: Marker at [[@LINE]]:12 = 1
|
int main() { // CHECK: Marker at [[@LINE]]:12 = 1
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
@ -118,6 +118,13 @@ void SourceCoverageView::renderRegionMarkers(raw_ostream &OS,
|
|||||||
Buffer.clear();
|
Buffer.clear();
|
||||||
}
|
}
|
||||||
OS << "\n";
|
OS << "\n";
|
||||||
|
|
||||||
|
if (Options.Debug) {
|
||||||
|
for (const auto &Region : Regions) {
|
||||||
|
errs() << "Marker at " << Region.Line << ":" << Region.Column << " = "
|
||||||
|
<< Region.ExecutionCount << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Insert a new highlighting range into the line's highlighting ranges
|
/// \brief Insert a new highlighting range into the line's highlighting ranges
|
||||||
@ -316,17 +323,24 @@ void SourceCoverageView::render(raw_ostream &OS, unsigned Offset) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void SourceCoverageView::setUpVisibleRange(SourceCoverageDataManager &Data) {
|
||||||
SourceCoverageView::createLineCoverageInfo(SourceCoverageDataManager &Data) {
|
|
||||||
auto CountedRegions = Data.getSourceRegions();
|
auto CountedRegions = Data.getSourceRegions();
|
||||||
if (!CountedRegions.size())
|
if (!CountedRegions.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LineOffset = CountedRegions.front().LineStart;
|
unsigned Start = CountedRegions.front().LineStart, End = 0;
|
||||||
LineStats.resize(CountedRegions.front().LineEnd - LineOffset + 1);
|
for (const auto &CR : CountedRegions) {
|
||||||
|
Start = std::min(Start, CR.LineStart);
|
||||||
|
End = std::max(End, CR.LineEnd);
|
||||||
|
}
|
||||||
|
LineOffset = Start;
|
||||||
|
LineStats.resize(End - Start + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SourceCoverageView::createLineCoverageInfo(SourceCoverageDataManager &Data) {
|
||||||
|
auto CountedRegions = Data.getSourceRegions();
|
||||||
for (const auto &CR : CountedRegions) {
|
for (const auto &CR : CountedRegions) {
|
||||||
if (CR.LineEnd > LineStats.size())
|
|
||||||
LineStats.resize(CR.LineEnd - LineOffset + 1);
|
|
||||||
if (CR.Kind == coverage::CounterMappingRegion::SkippedRegion) {
|
if (CR.Kind == coverage::CounterMappingRegion::SkippedRegion) {
|
||||||
// Reset the line stats for skipped regions.
|
// Reset the line stats for skipped regions.
|
||||||
for (unsigned Line = CR.LineStart; Line <= CR.LineEnd;
|
for (unsigned Line = CR.LineStart; Line <= CR.LineEnd;
|
||||||
@ -395,16 +409,10 @@ void SourceCoverageView::createRegionMarkers(SourceCoverageDataManager &Data) {
|
|||||||
if (CR.Kind != coverage::CounterMappingRegion::SkippedRegion)
|
if (CR.Kind != coverage::CounterMappingRegion::SkippedRegion)
|
||||||
Markers.push_back(
|
Markers.push_back(
|
||||||
RegionMarker(CR.LineStart, CR.ColumnStart, CR.ExecutionCount));
|
RegionMarker(CR.LineStart, CR.ColumnStart, CR.ExecutionCount));
|
||||||
|
|
||||||
if (Options.Debug) {
|
|
||||||
for (const auto &Marker : Markers) {
|
|
||||||
outs() << "Marker at " << Marker.Line << ":" << Marker.Column << " = "
|
|
||||||
<< Marker.ExecutionCount << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SourceCoverageView::load(SourceCoverageDataManager &Data) {
|
void SourceCoverageView::load(SourceCoverageDataManager &Data) {
|
||||||
|
setUpVisibleRange(Data);
|
||||||
if (Options.ShowLineStats)
|
if (Options.ShowLineStats)
|
||||||
createLineCoverageInfo(Data);
|
createLineCoverageInfo(Data);
|
||||||
if (Options.Colors)
|
if (Options.Colors)
|
||||||
|
@ -119,6 +119,9 @@ private:
|
|||||||
std::vector<RegionMarker> Markers;
|
std::vector<RegionMarker> Markers;
|
||||||
StringRef FunctionName;
|
StringRef FunctionName;
|
||||||
|
|
||||||
|
/// \brief Initialize the visible source range for this view.
|
||||||
|
void setUpVisibleRange(SourceCoverageDataManager &Data);
|
||||||
|
|
||||||
/// \brief Create the line coverage information using the coverage data.
|
/// \brief Create the line coverage information using the coverage data.
|
||||||
void createLineCoverageInfo(SourceCoverageDataManager &Data);
|
void createLineCoverageInfo(SourceCoverageDataManager &Data);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user