[PATCH] D116604: [llvm-strings] Remove use of hard coded executable name

Owen Reynolds via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 06:42:52 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb30a18f445ea: [llvm-strings] Remove use of hard coded executable name (authored by gbreynoo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116604/new/

https://reviews.llvm.org/D116604

Files:
  llvm/test/tools/llvm-strings/help.test
  llvm/test/tools/llvm-strings/length.test
  llvm/test/tools/llvm-strings/radix.test
  llvm/tools/llvm-strings/llvm-strings.cpp


Index: llvm/tools/llvm-strings/llvm-strings.cpp
===================================================================
--- llvm/tools/llvm-strings/llvm-strings.cpp
+++ llvm/tools/llvm-strings/llvm-strings.cpp
@@ -61,7 +61,7 @@
 };
 } // namespace
 
-const char ToolName[] = "llvm-strings";
+static StringRef ToolName;
 
 static cl::list<std::string> InputFileNames(cl::Positional,
                                             cl::desc("<input object files>"),
@@ -129,6 +129,7 @@
   BumpPtrAllocator A;
   StringSaver Saver(A);
   StringsOptTable Tbl;
+  ToolName = argv[0];
   opt::InputArgList Args =
       Tbl.parseArgs(argc, argv, OPT_UNKNOWN, Saver,
                     [&](StringRef Msg) { reportCmdLineError(Msg); });
Index: llvm/test/tools/llvm-strings/radix.test
===================================================================
--- llvm/test/tools/llvm-strings/radix.test
+++ llvm/test/tools/llvm-strings/radix.test
@@ -58,4 +58,4 @@
 
 ## Show that an invalid value is rejected.
 RUN: not llvm-strings --radix z %t/a.txt 2>&1 | FileCheck %s --check-prefix=INVALID
-INVALID: llvm-strings: error: --radix value should be one of: '' (no offset), 'o' (octal), 'd' (decimal), 'x' (hexadecimal)
+INVALID: error: --radix value should be one of: '' (no offset), 'o' (octal), 'd' (decimal), 'x' (hexadecimal)
Index: llvm/test/tools/llvm-strings/length.test
===================================================================
--- llvm/test/tools/llvm-strings/length.test
+++ llvm/test/tools/llvm-strings/length.test
@@ -23,7 +23,7 @@
 RUN: llvm-strings --bytes=2 %t | FileCheck --check-prefix CHECK-2 %s --implicit-check-not={{.}}
 RUN: llvm-strings -n 2 %t | FileCheck --check-prefix CHECK-2 %s --implicit-check-not={{.}}
 
-CHECK-0: llvm-strings: error: expected a positive integer, but got '0'
+CHECK-0: error: expected a positive integer, but got '0'
 
 CHECK-1:      a
 CHECK-1-NEXT: ab
@@ -43,4 +43,4 @@
 
 ## Show that a non-numeric argument is rejected.
 RUN: not llvm-strings -n foo %t 2>&1 | FileCheck %s --check-prefix=ERR
-ERR: llvm-strings: error: expected a positive integer, but got 'foo'
+ERR: error: expected a positive integer, but got 'foo'
Index: llvm/test/tools/llvm-strings/help.test
===================================================================
--- llvm/test/tools/llvm-strings/help.test
+++ llvm/test/tools/llvm-strings/help.test
@@ -4,7 +4,7 @@
 RUN: llvm-strings --help | FileCheck %s
 
 CHECK: OVERVIEW: llvm string dumper
-CHECK: USAGE: llvm-strings [options] <input object files>{{$}}
+CHECK: USAGE: {{.*}}llvm-strings{{(.exe)?}} [options] <input object files>{{$}}
 CHECK: OPTIONS:
 CHECK:   --all
 CHECK:   -a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116604.397556.patch
Type: text/x-patch
Size: 2649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220105/94301c57/attachment.bin>


More information about the llvm-commits mailing list