summaryrefslogtreecommitdiff
path: root/tools/llvm-cov
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-09-25 23:10:03 +0000
committerVedant Kumar <vsk@apple.com>2017-09-25 23:10:03 +0000
commit35ccd0b31ce4a4f291cc81907b6ea944406ca703 (patch)
tree0d42c0f6c08b4c5527895ef5446926e3848008e5 /tools/llvm-cov
parenta83f8fe1f1f228ec33cc8d8b27c6a15513121c94 (diff)
[llvm-cov] Warn if -show-functions is used without query files
llvm-cov's report mode does not print any output when -show-functions is specified and no source files are specified. This can be surprising, so the tool should at least print out an error message when this happens. rdar://problem/34636859 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-cov')
-rw-r--r--tools/llvm-cov/CodeCoverage.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/llvm-cov/CodeCoverage.cpp b/tools/llvm-cov/CodeCoverage.cpp
index ed87e9e8e61..1ea54a8cffd 100644
--- a/tools/llvm-cov/CodeCoverage.cpp
+++ b/tools/llvm-cov/CodeCoverage.cpp
@@ -931,10 +931,17 @@ int CodeCoverageTool::report(int argc, const char **argv,
return 1;
CoverageReport Report(ViewOpts, *Coverage.get());
- if (!ShowFunctionSummaries)
+ if (!ShowFunctionSummaries) {
Report.renderFileReports(llvm::outs());
- else
+ } else {
+ if (SourceFiles.empty()) {
+ error("Source files must be specified when -show-functions=true is "
+ "specified");
+ return 1;
+ }
+
Report.renderFunctionReports(SourceFiles, DC, llvm::outs());
+ }
return 0;
}