diff options
Diffstat (limited to 'llvm/tools/llvm-cov')
-rw-r--r-- | llvm/tools/llvm-cov/CodeCoverage.cpp | 17 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/CoverageReport.cpp | 5 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/CoverageReport.h | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp index feaa3fcd857..cf8ab337797 100644 --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -324,10 +324,11 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { for (const auto &File : InputSourceFiles) { SmallString<128> Path(File); - if (std::error_code EC = sys::fs::make_absolute(Path)) { - errs() << "error: " << File << ": " << EC.message(); - return 1; - } + if (!CompareFilenamesOnly) + if (std::error_code EC = sys::fs::make_absolute(Path)) { + errs() << "error: " << File << ": " << EC.message(); + return 1; + } SourceFiles.push_back(Path.str()); } return 0; @@ -459,12 +460,10 @@ int CodeCoverageTool::report(int argc, const char **argv, return 1; CoverageReport Report(ViewOpts, std::move(Coverage)); - if (SourceFiles.empty() && Filters.empty()) { + if (SourceFiles.empty()) Report.renderFileReports(llvm::outs()); - return 0; - } - - Report.renderFunctionReports(llvm::outs()); + else + Report.renderFunctionReports(SourceFiles, llvm::outs()); return 0; } diff --git a/llvm/tools/llvm-cov/CoverageReport.cpp b/llvm/tools/llvm-cov/CoverageReport.cpp index db0754268c3..497c2f88f26 100644 --- a/llvm/tools/llvm-cov/CoverageReport.cpp +++ b/llvm/tools/llvm-cov/CoverageReport.cpp @@ -155,9 +155,10 @@ void CoverageReport::render(const FunctionCoverageSummary &Function, OS << "\n"; } -void CoverageReport::renderFunctionReports(raw_ostream &OS) { +void CoverageReport::renderFunctionReports(ArrayRef<std::string> Files, + raw_ostream &OS) { bool isFirst = true; - for (StringRef Filename : Coverage->getUniqueSourceFiles()) { + for (StringRef Filename : Files) { if (isFirst) isFirst = false; else diff --git a/llvm/tools/llvm-cov/CoverageReport.h b/llvm/tools/llvm-cov/CoverageReport.h index 78e49d9b714..7ec3df90b8f 100644 --- a/llvm/tools/llvm-cov/CoverageReport.h +++ b/llvm/tools/llvm-cov/CoverageReport.h @@ -32,7 +32,7 @@ public: std::unique_ptr<coverage::CoverageMapping> Coverage) : Options(Options), Coverage(std::move(Coverage)) {} - void renderFunctionReports(raw_ostream &OS); + void renderFunctionReports(ArrayRef<std::string> Files, raw_ostream &OS); void renderFileReports(raw_ostream &OS); }; |