[PATCH] D49189: Omit path to lld binary from lld's error and warning diagnostics.
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 20 07:30:10 PDT 2018
thakis updated this revision to Diff 156486.
thakis edited the summary of this revision.
thakis added a comment.
Herald added subscribers: aheejin, sbc100.
print basename
https://reviews.llvm.org/D49189
Files:
lld/COFF/Driver.cpp
lld/COFF/InputFiles.cpp
lld/ELF/Driver.cpp
lld/lib/Driver/DarwinLdDriver.cpp
lld/wasm/Driver.cpp
Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ lld/wasm/Driver.cpp
@@ -74,7 +74,7 @@
bool lld::wasm::link(ArrayRef<const char *> Args, bool CanExitEarly,
raw_ostream &Error) {
- errorHandler().LogName = Args[0];
+ errorHandler().LogName = sys::path::filename(Args[0]);
errorHandler().ErrorOS = &Error;
errorHandler().ColorDiagnostics = Error.has_colors();
errorHandler().ErrorLimitExceededMsg =
Index: lld/lib/Driver/DarwinLdDriver.cpp
===================================================================
--- lld/lib/Driver/DarwinLdDriver.cpp
+++ lld/lib/Driver/DarwinLdDriver.cpp
@@ -1143,7 +1143,7 @@
/// This is where the link is actually performed.
bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly,
raw_ostream &Error) {
- errorHandler().LogName = args[0];
+ errorHandler().LogName = llvm::sys::path::filename(args[0]);
errorHandler().ErrorLimitExceededMsg =
"too many errors emitted, stopping now (use "
"'-error-limit 0' to see all errors)";
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -73,7 +73,7 @@
bool elf::link(ArrayRef<const char *> Args, bool CanExitEarly,
raw_ostream &Error) {
- errorHandler().LogName = Args[0];
+ errorHandler().LogName = sys::path::filename(Args[0]);
errorHandler().ErrorLimitExceededMsg =
"too many errors emitted, stopping now (use "
"-error-limit=0 to see all errors)";
Index: lld/COFF/InputFiles.cpp
===================================================================
--- lld/COFF/InputFiles.cpp
+++ lld/COFF/InputFiles.cpp
@@ -27,6 +27,7 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
#include "llvm/Target/TargetOptions.h"
#include <cstring>
#include <system_error>
@@ -488,10 +489,7 @@
// Returns the last element of a path, which is supposed to be a filename.
static StringRef getBasename(StringRef Path) {
- size_t Pos = Path.find_last_of("\\/");
- if (Pos == StringRef::npos)
- return Path;
- return Path.substr(Pos + 1);
+ return sys::path::filename(Path, sys::path::Style::windows);
}
// Returns a string in the format of "foo.obj" or "foo.obj(bar.lib)".
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -56,7 +56,7 @@
LinkerDriver *Driver;
bool link(ArrayRef<const char *> Args, bool CanExitEarly, raw_ostream &Diag) {
- errorHandler().LogName = Args[0];
+ errorHandler().LogName = sys::path::filename(Args[0]);
errorHandler().ErrorOS = &Diag;
errorHandler().ColorDiagnostics = Diag.has_colors();
errorHandler().ErrorLimitExceededMsg =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49189.156486.patch
Type: text/x-patch
Size: 2901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180720/d5437033/attachment.bin>
More information about the llvm-commits
mailing list