[PATCH] D56629: [llvm-readelf] Allow single-letter flags to be merged.

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 14 11:24:18 PST 2019


rupprecht added a comment.

In D56629#1355766 <https://reviews.llvm.org/D56629#1355766>, @jhenderson wrote:

> One question: what happens if you do enable grouping, and there's an ambiguous alias?


I believe there's a silent failure... I think it prefers the longer alias (i.e. registering s, r, and sr, will cause "-sr" to be interpreted as sr, not s and r).



================
Comment at: test/tools/llvm-readobj/merged.test:10
+# were supported.
+RUN: not llvm-readobj -aeWhSrnudlVgIs %p/Inputs/trivial.obj.elf-i386 |& FileCheck %s --check-prefix=UNKNOWN
+
----------------
jhenderson wrote:
> What's with the `|&` ?
It redirects stderr (i.e. the "unknown command line arg" we're checking) in a pipeline: https://www.gnu.org/software/bash/manual/bash.html#Pipelines

But 2>&1 works just as well and is more widely used (I can't find |& in any llvm tests, so lit probably doesn't support it), so I'll just use that.


================
Comment at: tools/llvm-readobj/llvm-readobj.cpp:654
+
+  // Allow all single letter flags to be grouped together.
+  opts::AllShort.setFormattingFlag(cl::Grouping);
----------------
jhenderson wrote:
> Could we come up with some way of enforcing this list to be extended by any new single letter aliases that are added? I don't know if it's possible, but one option might be to set grouping on by default, and disable it for llvm-readobj.
Yes, there is an API for that! Updated.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56629





More information about the llvm-commits mailing list