[llvm-cov] Improve error messages
While we're at it, extend an existing test to make sure that error
messages look reasonable.
llvm-svn: 275520
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 621f8d7..ed48c28 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -117,7 +117,7 @@
std::string Str = (Warning ? "warning" : "error");
Str += ": ";
if (!Whence.empty())
- Str += Whence;
+ Str += Whence.str() + ": ";
Str += Message.str() + "\n";
return Str;
}
@@ -504,7 +504,7 @@
if (!Filters.empty()) {
auto OSOrErr = Printer->createViewFile("functions", /*InToplevel=*/true);
if (Error E = OSOrErr.takeError()) {
- error(toString(std::move(E)));
+ error("Could not create view file!", toString(std::move(E)));
return 1;
}
auto OS = std::move(OSOrErr.get());
@@ -540,7 +540,7 @@
// Create an index out of the source files.
if (ViewOpts.hasOutputDirectory()) {
if (Error E = Printer->createIndexFile(SourceFiles)) {
- error(toString(std::move(E)));
+ error("Could not create index file!", toString(std::move(E)));
return 1;
}
}
@@ -561,7 +561,7 @@
auto OSOrErr = Printer->createViewFile(SourceFile, /*InToplevel=*/false);
if (Error E = OSOrErr.takeError()) {
- deferError(toString(std::move(E)));
+ deferError("Could not create view file!", toString(std::move(E)));
return;
}
auto OS = std::move(OSOrErr.get());