[llvm-cov] Avoid 0% when reporting something that's 0/0
This commit makes llvm-cov avoid showing 0% (0/0) coverage for things
like file function coverage, etc. in reports and HTML output. This can happen
for files like headers that have macros but no functions. This commit makes
llvm-cov report - (0/0) instead.
rdar://29246480
Differential Revision: https://reviews.llvm.org/D26615
llvm-svn: 287539
diff --git a/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmapping b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmapping
new file mode 100644
index 0000000..b2c198a
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.covmapping
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h
new file mode 100644
index 0000000..1703e8e
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.h
@@ -0,0 +1,3 @@
+// This header has no functions
+
+#define NOFUNCTIONS(x) (x) > 0 ? 0 : 1
diff --git a/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext
new file mode 100644
index 0000000..55187c1
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/zeroFunctionFile.proftext
@@ -0,0 +1,16 @@
+foo
+# Func Hash:
+13
+# Num Counters:
+2
+# Counter Values:
+1
+1
+
+main
+# Func Hash:
+0
+# Num Counters:
+1
+# Counter Values:
+1