llvm-cov: Actually use the command line arguments when reporting

This code didn't really make sense as is. If a filename is passed in,
the user obviously wants the coverage *for that file*, not *for
everything*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Justin Bogner
2015-02-14 02:05:05 +00:00
parent 9bdb194b86
commit 1ec34b0c61
5 changed files with 29 additions and 15 deletions

View File

@@ -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;
}