[PATCH] D110551: [llvm-objdump] Fix --prefix and --prefix-strip
Owen Reynolds via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 7 07:54:40 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9072183cb634: [llvm-objdump] Fix --prefix and --prefix-strip (authored by gbreynoo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110551/new/
https://reviews.llvm.org/D110551
Files:
llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
llvm/tools/llvm-objdump/ObjdumpOpts.td
Index: llvm/tools/llvm-objdump/ObjdumpOpts.td
===================================================================
--- llvm/tools/llvm-objdump/ObjdumpOpts.td
+++ llvm/tools/llvm-objdump/ObjdumpOpts.td
@@ -1,5 +1,12 @@
include "llvm/Option/OptParser.td"
+multiclass Eq<string name, string help> {
+ def NAME : Separate<["--"], name>;
+ def NAME #_eq : Joined<["--"], name #"=">,
+ Alias<!cast<Separate>(NAME)>,
+ HelpText<help>;
+}
+
def help : Flag<["--"], "help">,
HelpText<"Display available options (--help-hidden for more)">;
@@ -180,12 +187,12 @@
HelpText<"Ignored for compatibility with GNU objdump">;
def : Flag<["-"], "w">, Alias<wide>;
-def prefix : Separate<["--"], "prefix">,
- HelpText<"Add prefix to absolute paths">;
-
-def prefix_strip : Separate<["--"], "prefix-strip">,
- HelpText<"Strip out initial directories from absolute "
- "paths. No effect without --prefix">;
+defm prefix : Eq<"prefix", "Add prefix to absolute paths">,
+ MetaVarName<"prefix">;
+defm prefix_strip
+ : Eq<"prefix-strip", "Strip out initial directories from absolute "
+ "paths. No effect without --prefix">,
+ MetaVarName<"prefix">;
def debug_vars_EQ : Joined<["--"], "debug-vars=">,
Values<"unicode,ascii">;
Index: llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
+++ llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
@@ -89,3 +89,10 @@
; RUN: not llvm-objdump --prefix %p --prefix-strip foo --source %t-missing-prefix.o 2>&1 | \
; RUN: FileCheck %s --check-prefix=CHECK-INVALID-PREFIX-STRIP -DOPTION='foo'
+
+;; Test use of --prefix= and --prefix-strip=
+
+; RUN: sed -e "s,SRC_COMPDIR,/extra/Inputs,g" %p/Inputs/source-interleave.ll > %t-extra-path-prefix.ll
+; RUN: llc -o %t-extra-path-prefix.o -filetype=obj -mtriple=x86_64-pc-linux %t-extra-path-prefix.ll
+; RUN: llvm-objdump --prefix=%p --prefix-strip=1 --source %t-extra-path-prefix.o 2>&1 | \
+; RUN: FileCheck %s --check-prefix=CHECK-MISSING-PREFIX-FIX
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110551.377850.patch
Type: text/x-patch
Size: 2190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211007/2997f180/attachment.bin>
More information about the llvm-commits
mailing list