forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@287539 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
6 changed files
with
74 additions
and
20 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// This header has no functions | ||
|
||
#define NOFUNCTIONS(x) (x) > 0 ? 0 : 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "Inputs/zeroFunctionFile.h" | ||
|
||
int foo(int x) { | ||
return NOFUNCTIONS(x); | ||
} | ||
int main() { | ||
return foo(2); | ||
} | ||
|
||
// RUN: llvm-profdata merge %S/Inputs/zeroFunctionFile.proftext -o %t.profdata | ||
|
||
// RUN: llvm-cov report %S/Inputs/zeroFunctionFile.covmapping -instr-profile %t.profdata 2>&1 | FileCheck --check-prefix=REPORT --strict-whitespace %s | ||
// REPORT: 0 0 - 0 0 - 0 0 - 0 0 - | ||
// REPORT-NO: 0% | ||
|
||
// RUN: llvm-cov show %S/Inputs/zeroFunctionFile.covmapping -format html -instr-profile %t.profdata -o %t.dir | ||
// RUN: FileCheck %s -input-file=%t.dir/index.html -check-prefix=HTML | ||
// HTML: <td class='column-entry-green'><pre>- (0/0) | ||
// HTML-NO: 0.00% (0/0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters