[llvm] r267971 - [llvm-cov] Don't emit 'nan%' in reports
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 18:31:49 PDT 2016
Author: vedantk
Date: Thu Apr 28 20:31:49 2016
New Revision: 267971
URL: http://llvm.org/viewvc/llvm-project?rev=267971&view=rev
Log:
[llvm-cov] Don't emit 'nan%' in reports
Modified:
llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h
llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h
Modified: llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h?rev=267971&r1=267970&r2=267971&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h (original)
+++ llvm/trunk/test/tools/llvm-cov/prevent_false_instantiations.h Thu Apr 28 20:31:49 2016
@@ -1,9 +1,11 @@
// Checks that function instantiations don't go to a wrong file.
-// CHECK-NOT: {{_Z5func[1,2]v}}
+// INSTANTIATION-NOT: {{_Z5func[1,2]v}}
+// NAN-NOT: 0{{[ \t]+}}nan%{{[ \t]+}}0{{[ \t]+}}nan%
// RUN: llvm-profdata merge %S/Inputs/prevent_false_instantiations.proftext -o %t.profdata
-// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s
+// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck %s -check-prefix=INSTANTIATION
+// RUN: llvm-cov report %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %t.profdata | FileCheck %s -check-prefix=NAN
#define DO_SOMETHING() \
do { \
Modified: llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h?rev=267971&r1=267970&r2=267971&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h (original)
+++ llvm/trunk/tools/llvm-cov/CoverageSummaryInfo.h Thu Apr 28 20:31:49 2016
@@ -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;
}
};
More information about the llvm-commits
mailing list