[llvm] r313415 - [llvm-cov] Remove a redundant field. NFC.
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 15 16:00:01 PDT 2017
Author: vedantk
Date: Fri Sep 15 16:00:00 2017
New Revision: 313415
URL: http://llvm.org/viewvc/llvm-project?rev=313415&view=rev
Log:
[llvm-cov] Remove a redundant field. NFC.
The "NotCovered" fields in the region and line summary structs are
redundant. We should remove them to make the code clearer.
As a follow-up, the "NotCovered" entries should be removed from the
reports as well.
Modified:
llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp
llvm/trunk/tools/llvm-cov/CoverageReport.cpp
llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.cpp
llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h
Modified: llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp?rev=313415&r1=313414&r2=313415&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CoverageExporterJson.cpp Fri Sep 15 16:00:00 2017
@@ -395,7 +395,9 @@ class CoverageExporterJson {
emitDictStart();
emitDictElement("count", Summary.RegionCoverage.NumRegions);
emitDictElement("covered", Summary.RegionCoverage.Covered);
- emitDictElement("notcovered", Summary.RegionCoverage.NotCovered);
+ emitDictElement("notcovered",
+ Summary.RegionCoverage.NumRegions -
+ Summary.RegionCoverage.Covered);
emitDictElement("percent", Summary.RegionCoverage.getPercentCovered());
// End Region Coverage Summary.
emitDictEnd();
Modified: llvm/trunk/tools/llvm-cov/CoverageReport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageReport.cpp?rev=313415&r1=313414&r2=313415&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageReport.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CoverageReport.cpp Fri Sep 15 16:00:00 2017
@@ -187,7 +187,8 @@ void CoverageReport::render(const FileCo
OS << format("%*u", FileReportColumns[1],
(unsigned)File.RegionCoverage.NumRegions);
Options.colored_ostream(OS, FileCoverageColor) << format(
- "%*u", FileReportColumns[2], (unsigned)File.RegionCoverage.NotCovered);
+ "%*u", FileReportColumns[2], (unsigned)(File.RegionCoverage.NumRegions -
+ File.RegionCoverage.Covered));
if (File.RegionCoverage.NumRegions)
Options.colored_ostream(OS, FileCoverageColor)
<< format("%*.2f", FileReportColumns[3] - 1,
@@ -228,7 +229,8 @@ void CoverageReport::render(const FileCo
OS << format("%*u", FileReportColumns[10],
(unsigned)File.LineCoverage.NumLines);
Options.colored_ostream(OS, LineCoverageColor) << format(
- "%*u", FileReportColumns[11], (unsigned)File.LineCoverage.NotCovered);
+ "%*u", FileReportColumns[11],
+ (unsigned)(File.LineCoverage.NumLines - File.LineCoverage.Covered));
if (File.LineCoverage.NumLines)
Options.colored_ostream(OS, LineCoverageColor)
<< format("%*.2f", FileReportColumns[12] - 1,
@@ -252,7 +254,8 @@ void CoverageReport::render(const Functi
(unsigned)Function.RegionCoverage.NumRegions);
Options.colored_ostream(OS, FuncCoverageColor)
<< format("%*u", FunctionReportColumns[2],
- (unsigned)Function.RegionCoverage.NotCovered);
+ (unsigned)(Function.RegionCoverage.NumRegions -
+ Function.RegionCoverage.Covered));
Options.colored_ostream(
OS, determineCoveragePercentageColor(Function.RegionCoverage))
<< format("%*.2f", FunctionReportColumns[3] - 1,
@@ -262,7 +265,8 @@ void CoverageReport::render(const Functi
(unsigned)Function.LineCoverage.NumLines);
Options.colored_ostream(OS, LineCoverageColor)
<< format("%*u", FunctionReportColumns[5],
- (unsigned)Function.LineCoverage.NotCovered);
+ (unsigned)(Function.LineCoverage.NumLines -
+ Function.LineCoverage.Covered));
Options.colored_ostream(
OS, determineCoveragePercentageColor(Function.LineCoverage))
<< format("%*.2f", FunctionReportColumns[6] - 1,
Modified: llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.cpp?rev=313415&r1=313414&r2=313415&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.cpp Fri Sep 15 16:00:00 2017
@@ -89,12 +89,8 @@ FunctionCoverageSummary::get(const Insta
for (const auto &FCS : Summaries.drop_front()) {
Summary.RegionCoverage.Covered =
std::max(FCS.RegionCoverage.Covered, Summary.RegionCoverage.Covered);
- Summary.RegionCoverage.NotCovered = std::min(
- FCS.RegionCoverage.NotCovered, Summary.RegionCoverage.NotCovered);
Summary.LineCoverage.Covered =
std::max(FCS.LineCoverage.Covered, Summary.LineCoverage.Covered);
- Summary.LineCoverage.NotCovered =
- std::min(FCS.LineCoverage.NotCovered, Summary.LineCoverage.NotCovered);
}
return Summary;
}
Modified: llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h?rev=313415&r1=313414&r2=313415&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h (original)
+++ llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h Fri Sep 15 16:00:00 2017
@@ -25,21 +25,16 @@ struct RegionCoverageInfo {
/// \brief The number of regions that were executed at least once.
size_t Covered;
- /// \brief The number of regions that weren't executed.
- size_t NotCovered;
-
/// \brief The total number of regions in a function/file.
size_t NumRegions;
- RegionCoverageInfo() : Covered(0), NotCovered(0), NumRegions(0) {}
+ RegionCoverageInfo() : Covered(0), NumRegions(0) {}
RegionCoverageInfo(size_t Covered, size_t NumRegions)
- : Covered(Covered), NotCovered(NumRegions - Covered),
- NumRegions(NumRegions) {}
+ : Covered(Covered), NumRegions(NumRegions) {}
RegionCoverageInfo &operator+=(const RegionCoverageInfo &RHS) {
Covered += RHS.Covered;
- NotCovered += RHS.NotCovered;
NumRegions += RHS.NumRegions;
return *this;
}
@@ -58,20 +53,16 @@ struct LineCoverageInfo {
/// \brief The number of lines that were executed at least once.
size_t Covered;
- /// \brief The number of lines that weren't executed.
- size_t NotCovered;
-
/// \brief The total number of lines in a function/file.
size_t NumLines;
- LineCoverageInfo() : Covered(0), NotCovered(0), NumLines(0) {}
+ LineCoverageInfo() : Covered(0), NumLines(0) {}
LineCoverageInfo(size_t Covered, size_t NumLines)
- : Covered(Covered), NotCovered(NumLines - Covered), NumLines(NumLines) {}
+ : Covered(Covered), NumLines(NumLines) {}
LineCoverageInfo &operator+=(const LineCoverageInfo &RHS) {
Covered += RHS.Covered;
- NotCovered += RHS.NotCovered;
NumLines += RHS.NumLines;
return *this;
}
More information about the llvm-commits
mailing list