[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:50 PDT 2018


thakis updated this revision to Diff 162077.

https://reviews.llvm.org/D51133

Files:
  lld/COFF/Driver.cpp
  lld/ELF/Driver.cpp
  lld/lib/Driver/DarwinLdDriver.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/lib/Driver/DarwinLdDriver.cpp
===================================================================
--- lld/lib/Driver/DarwinLdDriver.cpp
+++ lld/lib/Driver/DarwinLdDriver.cpp
@@ -1143,7 +1143,10 @@
 /// This is where the link is actually performed.
 bool link(llvm::ArrayRef<const char *> args, bool CanExitEarly,
           raw_ostream &Error) {
-  errorHandler().LogName = llvm::sys::path::filename(args[0]);
+  if (llvm::sys::path::extension(args[0]) == ".exe")
+    errorHandler().LogName = llvm::sys::path::stem(args[0]);
+  else
+    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
@@ -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.162077.patch
Type: text/x-patch
Size: 3081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180822/38b19939/attachment.bin>


More information about the llvm-commits mailing list