[llvm] 92d3c32 - [llvm-driver] Allow llvm driver binary to be called anything
Alex Brachet via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 3 11:45:24 PST 2023
Author: Alex Brachet
Date: 2023-03-03T19:45:03Z
New Revision: 92d3c3294ac4dd292238e44be64c1b9821dd842f
URL: https://github.com/llvm/llvm-project/commit/92d3c3294ac4dd292238e44be64c1b9821dd842f
DIFF: https://github.com/llvm/llvm-project/commit/92d3c3294ac4dd292238e44be64c1b9821dd842f.diff
LOG: [llvm-driver] Allow llvm driver binary to be called anything
Added:
llvm/test/tools/llvm-driver/not-called-llvm.test
Modified:
llvm/tools/llvm-driver/llvm-driver.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-driver/not-called-llvm.test b/llvm/test/tools/llvm-driver/not-called-llvm.test
new file mode 100644
index 0000000000000..046ffa514ffec
--- /dev/null
+++ b/llvm/test/tools/llvm-driver/not-called-llvm.test
@@ -0,0 +1,12 @@
+## Don't make symlinks on Windows.
+# UNSUPPORTED: system-windows
+# REQUIRES: llvm-driver
+
+# RUN: rm -rf %t
+# RUN: mkdir %t
+# RUN: ln -s %llvm %t/invalidtool
+# RUN: %t/invalidtool cxxfilt --help | FileCheck %s
+
+# CHECK: OVERVIEW: LLVM symbol undecoration tool
+
+# RUN: not %llvm invalidtool cxxfilt --help
diff --git a/llvm/tools/llvm-driver/llvm-driver.cpp b/llvm/tools/llvm-driver/llvm-driver.cpp
index 01c27618945ce..11e79ed593410 100644
--- a/llvm/tools/llvm-driver/llvm-driver.cpp
+++ b/llvm/tools/llvm-driver/llvm-driver.cpp
@@ -73,7 +73,7 @@ static int findTool(int Argc, char **Argv, const char *Argv0) {
return entry##_main(Argc, Argv, MakeDriverArgs());
#include "LLVMDriverTools.def"
- if (Is("llvm"))
+ if (Is("llvm") || Argv0 == Argv[0])
return findTool(Argc - 1, Argv + 1, Argv0);
printHelpMessage();
More information about the llvm-commits
mailing list