[lld] r340487 - win: Omit ".exe" from lld warning and error messages.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 22 16:52:13 PDT 2018
Author: nico
Date: Wed Aug 22 16:52:13 2018
New Revision: 340487
URL: http://llvm.org/viewvc/llvm-project?rev=340487&view=rev
Log:
win: Omit ".exe" from lld warning and error messages.
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
Modified:
lld/trunk/COFF/Driver.cpp
lld/trunk/Common/Args.cpp
lld/trunk/ELF/Driver.cpp
lld/trunk/include/lld/Common/Args.h
lld/trunk/lib/Driver/DarwinLdDriver.cpp
lld/trunk/test/ELF/lto-plugin-ignore.s
lld/trunk/wasm/Driver.cpp
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Wed Aug 22 16:52:13 2018
@@ -56,7 +56,7 @@ Configuration *Config;
LinkerDriver *Driver;
bool link(ArrayRef<const char *> Args, bool CanExitEarly, raw_ostream &Diag) {
- errorHandler().LogName = sys::path::filename(Args[0]);
+ errorHandler().LogName = args::FilenameWithoutExe(Args[0]);
errorHandler().ErrorOS = &Diag;
errorHandler().ColorDiagnostics = Diag.has_colors();
errorHandler().ErrorLimitExceededMsg =
Modified: lld/trunk/Common/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/Common/Args.cpp?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/Common/Args.cpp (original)
+++ lld/trunk/Common/Args.cpp Wed Aug 22 16:52:13 2018
@@ -13,6 +13,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Option/ArgList.h"
+#include "llvm/Support/Path.h"
using namespace llvm;
using namespace lld;
@@ -64,3 +65,9 @@ std::vector<StringRef> lld::args::getLin
}
return Ret;
}
+
+StringRef lld::args::FilenameWithoutExe(StringRef Path) {
+ if (Path.endswith_lower(".exe"))
+ return sys::path::stem(Path);
+ return sys::path::filename(Path);
+}
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed Aug 22 16:52:13 2018
@@ -74,7 +74,7 @@ static void setConfigs(opt::InputArgList
bool elf::link(ArrayRef<const char *> Args, bool CanExitEarly,
raw_ostream &Error) {
- errorHandler().LogName = sys::path::filename(Args[0]);
+ errorHandler().LogName = args::FilenameWithoutExe(Args[0]);
errorHandler().ErrorLimitExceededMsg =
"too many errors emitted, stopping now (use "
"-error-limit=0 to see all errors)";
Modified: lld/trunk/include/lld/Common/Args.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Common/Args.h?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/include/lld/Common/Args.h (original)
+++ lld/trunk/include/lld/Common/Args.h Wed Aug 22 16:52:13 2018
@@ -29,6 +29,9 @@ uint64_t getZOptionValue(llvm::opt::Inpu
uint64_t Default);
std::vector<StringRef> getLines(MemoryBufferRef MB);
+
+StringRef FilenameWithoutExe(StringRef Path);
+
} // namespace args
} // namespace lld
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Wed Aug 22 16:52:13 2018
@@ -1143,7 +1143,7 @@ static void createFiles(MachOLinkingCont
/// 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]);
+ errorHandler().LogName = args::FilenameWithoutExe(args[0]);
errorHandler().ErrorLimitExceededMsg =
"too many errors emitted, stopping now (use "
"'-error-limit 0' to see all errors)";
Modified: lld/trunk/test/ELF/lto-plugin-ignore.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto-plugin-ignore.s?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto-plugin-ignore.s (original)
+++ lld/trunk/test/ELF/lto-plugin-ignore.s Wed Aug 22 16:52:13 2018
@@ -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'
Modified: lld/trunk/wasm/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Driver.cpp?rev=340487&r1=340486&r2=340487&view=diff
==============================================================================
--- lld/trunk/wasm/Driver.cpp (original)
+++ lld/trunk/wasm/Driver.cpp Wed Aug 22 16:52:13 2018
@@ -78,7 +78,7 @@ private:
bool lld::wasm::link(ArrayRef<const char *> Args, bool CanExitEarly,
raw_ostream &Error) {
- errorHandler().LogName = sys::path::filename(Args[0]);
+ errorHandler().LogName = args::FilenameWithoutExe(Args[0]);
errorHandler().ErrorOS = &Error;
errorHandler().ColorDiagnostics = Error.has_colors();
errorHandler().ErrorLimitExceededMsg =
More information about the llvm-commits
mailing list