[PATCH] D51133: win: Omit ".exe" from lld warning and error messages.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 22 15:42:06 PDT 2018


thakis created this revision.
thakis added a reviewer: ruiu.
Herald added subscribers: dexonsmith, steven_wu, aheejin, arichardson, sbc100, emaste.
Herald added a reviewer: espindola.

This is a minor follow-up to https://reviews.llvm.org/D49189. On Windows, lld used to print "lld-link.exe: error: ...". Now it just prints "lld-link: error: ...". This matches what link.exe does (it prints "LINK : ...") and makes lld's output less dependent on the host system.


https://reviews.llvm.org/D51133

Files:
  lld/COFF/Driver.cpp
  lld/ELF/Driver.cpp
  lld/test/ELF/lto-plugin-ignore.s
  lld/wasm/Driver.cpp


Index: lld/wasm/Driver.cpp
===================================================================
--- lld/wasm/Driver.cpp
+++ lld/wasm/Driver.cpp
@@ -78,7 +78,7 @@
 
 bool lld::wasm::link(ArrayRef<const char *> Args, bool CanExitEarly,
                      raw_ostream &Error) {
-  errorHandler().LogName = sys::path::filename(Args[0]);
+  errorHandler().LogName = sys::path::stem(Args[0]);
   errorHandler().ErrorOS = &Error;
   errorHandler().ColorDiagnostics = Error.has_colors();
   errorHandler().ErrorLimitExceededMsg =
Index: lld/test/ELF/lto-plugin-ignore.s
===================================================================
--- lld/test/ELF/lto-plugin-ignore.s
+++ lld/test/ELF/lto-plugin-ignore.s
@@ -6,5 +6,5 @@
 # RUN:   -plugin-opt=-data-sections -plugin-opt=thinlto -o /dev/null
 
 # RUN: not ld.lld %t -plugin-opt=-abc -plugin-opt=-xyz 2>&1 | FileCheck %s
-# CHECK: error: --plugin-opt: ld.lld{{.*}}: Unknown command line argument '-abc'
-# CHECK: error: --plugin-opt: ld.lld{{.*}}: Unknown command line argument '-xyz'
+# CHECK: error: --plugin-opt: ld.lld: Unknown command line argument '-abc'
+# CHECK: error: --plugin-opt: ld.lld: Unknown command line argument '-xyz'
Index: lld/ELF/Driver.cpp
===================================================================
--- lld/ELF/Driver.cpp
+++ lld/ELF/Driver.cpp
@@ -74,7 +74,10 @@
 
 bool elf::link(ArrayRef<const char *> Args, bool CanExitEarly,
                raw_ostream &Error) {
-  errorHandler().LogName = sys::path::filename(Args[0]);
+  if (sys::path::extension(Args[0]) == ".exe")
+    errorHandler().LogName = sys::path::stem(Args[0]);
+  else
+    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/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 = sys::path::filename(Args[0]);
+  errorHandler().LogName = sys::path::stem(Args[0]);
   errorHandler().ErrorOS = &Diag;
   errorHandler().ColorDiagnostics = Diag.has_colors();
   errorHandler().ErrorLimitExceededMsg =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51133.162075.patch
Type: text/x-patch
Size: 2329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180822/9ccc328a/attachment.bin>


More information about the llvm-commits mailing list