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
// RUN: llvm-cov report %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=,%S 2>&1 -show-region-summary -show-instantiation-summary | FileCheck %s
// RUN: llvm-cov report -show-functions %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=,%S %s 2>&1 | FileCheck -check-prefix=FILT %s
// RUN: llvm-cov report -show-functions %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=,%S %s does-not-exist.cpp 2>&1 | FileCheck -check-prefix=FILT %s
+// RUN: not llvm-cov report -show-functions %S/Inputs/report.covmapping -instr-profile %S/Inputs/report.profdata -path-equivalence=,%S 2>&1 | FileCheck -check-prefix=NO_FILES %s
+
+// NO_FILES: Source files must be specified when -show-functions=true is specified
// CHECK: Regions Missed Regions Cover Functions Missed Functions Executed Instantiations Missed Insts. Executed Lines Missed Lines Cover
// CHECK-NEXT: ---
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;
}