[PATCH] D62070: Update llvm-nm -s to use a multi-var option
Michael Trent via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 11:07:37 PDT 2019
mtrent created this revision.
mtrent added reviewers: lhames, pete.
Herald added a subscriber: rupprecht.
Herald added a project: LLVM.
Previously llvm-nm relied on a positional parameter to read two values
into the SegSect list. This worked, but required the "-s" paramater and
its arguments to be the last elements on the command-line.
The CommandLine library now supports mutli-var parameters, so it can
naturally deal with "-s" expecting two arguments, and now the input file
can appear anywhere (within reason) in the command line invocation. E.g.
llvm-nm -s __TEXT __text /bin/ls
llvm-nm /bin/ls -s __TEXT __text
rdar://27284011
Repository:
rL LLVM
https://reviews.llvm.org/D62070
Files:
tools/llvm-nm/llvm-nm.cpp
Index: tools/llvm-nm/llvm-nm.cpp
===================================================================
--- tools/llvm-nm/llvm-nm.cpp
+++ tools/llvm-nm/llvm-nm.cpp
@@ -1,3 +1,4 @@
+
//===-- llvm-nm.cpp - Symbol table dumping utility for llvm ---------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
@@ -183,12 +184,7 @@
cl::opt<bool> SpecialSyms("special-syms",
cl::desc("No-op. Used for GNU compatibility only"));
-// FIXME: This option takes exactly two strings and should be allowed anywhere
-// on the command line. Such that "llvm-nm -s __TEXT __text foo.o" would work.
-// But that does not as the CommandLine Library does not have a way to make
-// this work. For now the "-s __TEXT __text" has to be last on the command
-// line.
-cl::list<std::string> SegSect("s", cl::Positional, cl::ZeroOrMore,
+cl::list<std::string> SegSect("s", cl::multi_val(2), cl::ZeroOrMore,
cl::value_desc("segment section"), cl::Hidden,
cl::desc("Dump only symbols from this segment "
"and section name, Mach-O only"),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62070.200065.patch
Type: text/x-patch
Size: 1187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/ed7b3a78/attachment.bin>
More information about the llvm-commits
mailing list