From: Vedant Kumar Date: Mon, 19 Sep 2016 01:46:01 +0000 (+0000) Subject: [llvm-cov] Delete the NonCodeLines field, it was always dead X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b70b5dcc98c7a28f765893be27dbfa6339725d8;p=llvm [llvm-cov] Delete the NonCodeLines field, it was always dead git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281882 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/tools/llvm-cov/Inputs/binary-formats.canonical.json b/test/tools/llvm-cov/Inputs/binary-formats.canonical.json index 276bbfa4e30..46ada64e731 100644 --- a/test/tools/llvm-cov/Inputs/binary-formats.canonical.json +++ b/test/tools/llvm-cov/Inputs/binary-formats.canonical.json @@ -1,5 +1,5 @@ // Metadata section -// CHECK: {"version":"1.0.0","type":"llvm.coverage.json.export","data":[ +// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[ // Open Export // CHECK-SAME: {"object":"{{[^"]+}}","files":[ @@ -12,7 +12,7 @@ // Verify the Summary Section for the first file // CHECK-SAME: "summary":{ -// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100,"noncode":0}, +// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":1,"covered":1,"notcovered":0,"percent":100}}} @@ -30,7 +30,7 @@ // Full Export Summary // CHECK-SAME: "totals":{ -// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100,"noncode":0}, +// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":1,"covered":1,"notcovered":0,"percent":100}} diff --git a/test/tools/llvm-cov/Inputs/highlightedRanges.json b/test/tools/llvm-cov/Inputs/highlightedRanges.json index 0ef3cde17d2..ddd472e44ec 100644 --- a/test/tools/llvm-cov/Inputs/highlightedRanges.json +++ b/test/tools/llvm-cov/Inputs/highlightedRanges.json @@ -1,5 +1,5 @@ // Metadata section -// CHECK: {"version":"1.0.0","type":"llvm.coverage.json.export","data":[ +// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[ // Open Export // CHECK-SAME: {"object":"{{[^"]+}}","files":[ @@ -12,7 +12,7 @@ // Verify the Summary Section for the first file // CHECK-SAME: "summary":{ -// CHECK-SAME: "lines":{"count":40,"covered":26,"percent":65,"noncode":0}, +// CHECK-SAME: "lines":{"count":40,"covered":26,"percent":65}, // CHECK-SAME: "functions":{"count":4,"covered":4,"percent":100}, // CHECK-SAME: "regions":{"count":19,"covered":11,"notcovered":8,"percent":57}}} @@ -45,7 +45,7 @@ // Full Export Summary // CHECK-SAME: "totals":{ -// CHECK-SAME: "lines":{"count":40,"covered":26,"percent":65,"noncode":0}, +// CHECK-SAME: "lines":{"count":40,"covered":26,"percent":65}, // CHECK-SAME: "functions":{"count":4,"covered":4,"percent":100}, // CHECK-SAME: "instantiations":{"count":4,"covered":4,"percent":100}, // CHECK-SAME: "regions":{"count":19,"covered":11,"notcovered":8,"percent":57}} diff --git a/test/tools/llvm-cov/Inputs/lineExecutionCounts.json b/test/tools/llvm-cov/Inputs/lineExecutionCounts.json index ff1c8f59dba..e07d0982677 100644 --- a/test/tools/llvm-cov/Inputs/lineExecutionCounts.json +++ b/test/tools/llvm-cov/Inputs/lineExecutionCounts.json @@ -1,5 +1,5 @@ // Metadata section -// CHECK: {"version":"1.0.0","type":"llvm.coverage.json.export","data":[ +// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[ // Open Export // CHECK-SAME: {"object":"{{[^"]+}}","files":[ @@ -12,7 +12,7 @@ // Verify the Summary Section for the first file // CHECK-SAME: "summary":{ -// CHECK-SAME: "lines":{"count":20,"covered":16,"percent":80,"noncode":0}, +// CHECK-SAME: "lines":{"count":20,"covered":16,"percent":80}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":10,"covered":7,"notcovered":3,"percent":70}}} @@ -30,7 +30,7 @@ // Full Export Summary // CHECK-SAME: "totals":{ -// CHECK-SAME: "lines":{"count":20,"covered":16,"percent":80,"noncode":0}, +// CHECK-SAME: "lines":{"count":20,"covered":16,"percent":80}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":10,"covered":7,"notcovered":3,"percent":70}} diff --git a/test/tools/llvm-cov/Inputs/regionMarkers.json b/test/tools/llvm-cov/Inputs/regionMarkers.json index 5bc506e4071..9048768c8ee 100644 --- a/test/tools/llvm-cov/Inputs/regionMarkers.json +++ b/test/tools/llvm-cov/Inputs/regionMarkers.json @@ -1,5 +1,5 @@ // Metadata section -// CHECK: {"version":"1.0.0","type":"llvm.coverage.json.export","data":[ +// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[ // Open Export // CHECK-SAME: {"object":"{{[^"]+}}","files":[ @@ -12,7 +12,7 @@ // Verify the Summary Section for the first file // CHECK-SAME: "summary":{ -// CHECK-SAME: "lines":{"count":21,"covered":17,"percent":80,"noncode":0}, +// CHECK-SAME: "lines":{"count":21,"covered":17,"percent":80}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":10,"covered":7,"notcovered":3,"percent":70}} @@ -29,7 +29,7 @@ // Full Export Summary // CHECK-SAME: "totals":{ -// CHECK-SAME: "lines":{"count":21,"covered":17,"percent":80,"noncode":0}, +// CHECK-SAME: "lines":{"count":21,"covered":17,"percent":80}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":10,"covered":7,"notcovered":3,"percent":70}} diff --git a/test/tools/llvm-cov/Inputs/showExpansions.json b/test/tools/llvm-cov/Inputs/showExpansions.json index 4a5bb9037fa..6821fd6ac8a 100644 --- a/test/tools/llvm-cov/Inputs/showExpansions.json +++ b/test/tools/llvm-cov/Inputs/showExpansions.json @@ -1,5 +1,5 @@ // Metadata section -// CHECK: {"version":"1.0.0","type":"llvm.coverage.json.export","data":[ +// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[ // Open Export // CHECK-SAME: {"object":"{{[^"]+}}","files":[ @@ -22,7 +22,7 @@ // Verify the Summary Section for the first file // CHECK-SAME: "summary":{ -// CHECK-SAME: "lines":{"count":17,"covered":15,"percent":88,"noncode":0}, +// CHECK-SAME: "lines":{"count":17,"covered":15,"percent":88}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":13,"covered":12,"notcovered":1,"percent":92}} @@ -43,7 +43,7 @@ // Full Export Summary // CHECK-SAME: "totals":{ -// CHECK-SAME: "lines":{"count":17,"covered":15,"percent":88,"noncode":0}, +// CHECK-SAME: "lines":{"count":17,"covered":15,"percent":88}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":13,"covered":12,"notcovered":1,"percent":92}} diff --git a/test/tools/llvm-cov/Inputs/universal-binary.json b/test/tools/llvm-cov/Inputs/universal-binary.json index edf09f374f7..ec32adbe2a5 100644 --- a/test/tools/llvm-cov/Inputs/universal-binary.json +++ b/test/tools/llvm-cov/Inputs/universal-binary.json @@ -1,5 +1,5 @@ // Metadata section -// CHECK: {"version":"1.0.0","type":"llvm.coverage.json.export","data":[ +// CHECK: {"version":"1.1.0","type":"llvm.coverage.json.export","data":[ // Open Export // CHECK-SAME: {"object":"{{[^"]+}}","files":[ @@ -12,7 +12,7 @@ // Verify the Summary Section for the first file // CHECK-SAME: "summary":{ -// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100,"noncode":0}, +// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":1,"covered":1,"notcovered":0,"percent":100}} @@ -28,7 +28,7 @@ // Full Export Summary // CHECK-SAME: "totals":{ -// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100,"noncode":0}, +// CHECK-SAME: "lines":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "functions":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "instantiations":{"count":1,"covered":1,"percent":100}, // CHECK-SAME: "regions":{"count":1,"covered":1,"notcovered":0,"percent":100} diff --git a/tools/llvm-cov/CoverageExporterJson.cpp b/tools/llvm-cov/CoverageExporterJson.cpp index e2a798f4e69..e8dee147c00 100644 --- a/tools/llvm-cov/CoverageExporterJson.cpp +++ b/tools/llvm-cov/CoverageExporterJson.cpp @@ -47,17 +47,8 @@ #include "llvm/ProfileData/Coverage/CoverageMapping.h" #include -/// \brief Major version of the JSON Coverage Export Format. -#define LLVM_COVERAGE_EXPORT_JSON_MAJOR 1 - -/// \brief Minor version of the JSON Coverage Export Format. -#define LLVM_COVERAGE_EXPORT_JSON_MINOR 0 - -/// \brief Patch version of the JSON Coverage Export Format. -#define LLVM_COVERAGE_EXPORT_JSON_PATCH 0 - /// \brief The semantic version combined as a string. -#define LLVM_COVERAGE_EXPORT_JSON_STR "1.0.0" +#define LLVM_COVERAGE_EXPORT_JSON_STR "1.1.0" /// \brief Unique type identifier for JSON coverage export. #define LLVM_COVERAGE_EXPORT_JSON_TYPE_STR "llvm.coverage.json.export" @@ -377,7 +368,6 @@ class CoverageExporterJson { emitDictElement("count", Summary.LineCoverage.NumLines); emitDictElement("covered", Summary.LineCoverage.Covered); emitDictElement("percent", Summary.LineCoverage.getPercentCovered()); - emitDictElement("noncode", Summary.LineCoverage.NonCodeLines); // End Line Coverage Summary. emitDictEnd(); diff --git a/tools/llvm-cov/CoverageSummaryInfo.cpp b/tools/llvm-cov/CoverageSummaryInfo.cpp index 396cd655ca1..21aa7ff73a0 100644 --- a/tools/llvm-cov/CoverageSummaryInfo.cpp +++ b/tools/llvm-cov/CoverageSummaryInfo.cpp @@ -67,7 +67,7 @@ FunctionCoverageSummary::get(const coverage::FunctionRecord &Function) { return FunctionCoverageSummary( Function.Name, Function.ExecutionCount, RegionCoverageInfo(CoveredRegions, NumCodeRegions), - LineCoverageInfo(CoveredLines, 0, NumLines)); + LineCoverageInfo(CoveredLines, NumLines)); } void FunctionCoverageSummary::update(const FunctionCoverageSummary &Summary) { diff --git a/tools/llvm-cov/CoverageSummaryInfo.h b/tools/llvm-cov/CoverageSummaryInfo.h index acf240d95de..c04a4d42ccd 100644 --- a/tools/llvm-cov/CoverageSummaryInfo.h +++ b/tools/llvm-cov/CoverageSummaryInfo.h @@ -61,33 +61,27 @@ struct LineCoverageInfo { /// \brief The number of lines that weren't executed. size_t NotCovered; - /// \brief The number of lines that aren't code. - size_t NonCodeLines; - /// \brief The total number of lines in a function/file. size_t NumLines; - LineCoverageInfo() - : Covered(0), NotCovered(0), NonCodeLines(0), NumLines(0) {} + LineCoverageInfo() : Covered(0), NotCovered(0), NumLines(0) {} - LineCoverageInfo(size_t Covered, size_t NumNonCodeLines, size_t NumLines) - : Covered(Covered), NotCovered(NumLines - NumNonCodeLines - Covered), - NonCodeLines(NumNonCodeLines), NumLines(NumLines) {} + LineCoverageInfo(size_t Covered, size_t NumLines) + : Covered(Covered), NotCovered(NumLines - Covered), NumLines(NumLines) {} LineCoverageInfo &operator+=(const LineCoverageInfo &RHS) { Covered += RHS.Covered; NotCovered += RHS.NotCovered; - NonCodeLines += RHS.NonCodeLines; NumLines += RHS.NumLines; return *this; } - bool isFullyCovered() const { return Covered == (NumLines - NonCodeLines); } + bool isFullyCovered() const { return Covered == NumLines; } double getPercentCovered() const { - if (NumLines - NonCodeLines == 0) + if (NumLines == 0) return 0.0; - return double(Covered) / double(NumLines - NonCodeLines) * 100.0; + return double(Covered) / double(NumLines) * 100.0; } };