summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-04-29 01:31:49 +0000
committerVedant Kumar <vsk@apple.com>2016-04-29 01:31:49 +0000
commit78b8bc29db8177ad133a4d04de45fe14bcf220bd (patch)
tree947cd12698310c9620ba664cbdd33b58b1aa12c1 /llvm/tools
parent1b66f7e3c8374aa39e51f47d4e0742a5ba15f894 (diff)
downloadbcm5719-llvm-78b8bc29db8177ad133a4d04de45fe14bcf220bd.tar.gz
bcm5719-llvm-78b8bc29db8177ad133a4d04de45fe14bcf220bd.zip
[llvm-cov] Don't emit 'nan%' in reports
llvm-svn: 267971
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-cov/CoverageSummaryInfo.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-cov/CoverageSummaryInfo.h b/llvm/tools/llvm-cov/CoverageSummaryInfo.h
index c393b00d32a..a8902042403 100644
--- a/llvm/tools/llvm-cov/CoverageSummaryInfo.h
+++ b/llvm/tools/llvm-cov/CoverageSummaryInfo.h
@@ -47,6 +47,8 @@ struct RegionCoverageInfo {
bool isFullyCovered() const { return Covered == NumRegions; }
double getPercentCovered() const {
+ if (NumRegions == 0)
+ return 0.0;
return double(Covered) / double(NumRegions) * 100.0;
}
};
@@ -83,6 +85,8 @@ struct LineCoverageInfo {
bool isFullyCovered() const { return Covered == (NumLines - NonCodeLines); }
double getPercentCovered() const {
+ if (NumLines - NonCodeLines == 0)
+ return 0.0;
return double(Covered) / double(NumLines - NonCodeLines) * 100.0;
}
};
@@ -109,6 +113,8 @@ struct FunctionCoverageInfo {
bool isFullyCovered() const { return Executed == NumFunctions; }
double getPercentCovered() const {
+ if (NumFunctions == 0)
+ return 0.0;
return double(Executed) / double(NumFunctions) * 100.0;
}
};
OpenPOWER on IntegriCloud