[llvm-cov] Delete the NonCodeLines field, it was always dead

llvm-svn: 281882
This commit is contained in:
Vedant Kumar 2016-09-19 01:46:01 +00:00
parent fca2ef5fb0
commit f64114d9a8
9 changed files with 26 additions and 42 deletions

View File

@ -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}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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}}

View File

@ -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}

View File

@ -47,17 +47,8 @@
#include "llvm/ProfileData/Coverage/CoverageMapping.h"
#include <stack>
/// \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();

View File

@ -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) {

View File

@ -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;
}
};