summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-14 19:55:43 +0000
committerpatrick <patrick@openbsd.org>2017-01-14 19:55:43 +0000
commitbd3306aecb3a15e8967143b8cdbbccf2b1b19b74 (patch)
tree309a8132b44564b9e634c0da6815187ce8eab27c /gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h
parentkillp -a should not kill the window if only one pane. (diff)
downloadwireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.tar.xz
wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.zip
Import LLVM 3.9.1 including clang and lld.
Diffstat (limited to 'gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h')
-rw-r--r--gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h b/gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h
index c393b00d32a..822742b635e 100644
--- a/gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h
+++ b/gnu/llvm/tools/llvm-cov/CoverageSummaryInfo.h
@@ -15,7 +15,7 @@
#ifndef LLVM_COV_COVERAGESUMMARYINFO_H
#define LLVM_COV_COVERAGESUMMARYINFO_H
-#include "llvm/ProfileData/CoverageMapping.h"
+#include "llvm/ProfileData/Coverage/CoverageMapping.h"
#include "llvm/Support/raw_ostream.h"
namespace llvm {
@@ -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;
}
};