[PATCH] D53983: [llvm-objcopy] For multiclass Eq, associate help text with --name= , not --name

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 11:59:50 PDT 2018


rupprecht added inline comments.


================
Comment at: tools/llvm-objcopy/ObjcopyOpts.td:10
 def help : Flag<["-", "--"], "help">;
-defm binary_architecture : Eq<"binary-architecture">,
-                           HelpText<"Used when transforming an architecture-less format (such as binary) to another format">;
+defm binary_architecture : Eq<"binary-architecture", "Used when transforming an architecture-less format (such as binary) to another format">;
 def B : JoinedOrSeparate<["-"], "B">,
----------------
MaskRay wrote:
> rupprecht wrote:
> > jhenderson wrote:
> > > Might be worth on some of these long lines to break it over two lines, e.g:
> > > 
> > > ```
> > > defm binary_architecture : Eq<"binary-architecture",
> > >   "Used when transforming an architecture-less format (such as binary) to another format">;
> > > ```
> > > or similar. Not sure about the indentation of the second line.
> > FWIW, I've been looking at making clang-format deal with tablegen better so this can be automated. clang-format knows how to break this up but it gets gnarly because it doesn't deal with line breaks well.
> > 
> > D53952 (but I have one more local change that I need to upload to make it deal with ["-", "--"] spacing)
> I find that `clang-format` fails to format `keep_global_symbols`:
> 
> defm keep_global_symbols
>     : Eq<
>           "keep-global-symbols", "Reads a list of symbols from <filename> and "
>                                  "runs as if " "--keep-global-symbol=<symbol> "
>                                                "is set for each one. "
>                                                "<filename> " "contains one "
>                                                              "symbol per line "
>                                                              "and may contain "
>                                                              "comments "
>                                                              "beginning " "with"
>                                                                           " '#'"
>                                                                           ". "
>                                                                           "Lead"
>                                                                           "ing "
> 
> Wondering if @kristina has plan to improve the printing of help message:
> 
> Right now, alias options are printed separately (if set to `NonHidden` explicitly)
> 
>     -syms                                     - Display the symbol table
>     -t                                        - Alias for --syms
> 
> I think this following tight form is better (I have a slight personal preference that short options follow the long ones and options are sorted by the long options:
> 
>     -syms, -t            - Display the symbol table
> 
That formatting nonsense is exactly what D53952 fixes.

```
$ <patch D53952>
$ ninja bin/clang-format
$ git-clang-format --extensions td --binary /path/to/custom/clang-format master
```

Agree about the tight form being better. I'm more used to the alias first, but maybe I spend too much time looking at gnu manpages. I'd be happy with either order.


Repository:
  rL LLVM

https://reviews.llvm.org/D53983





More information about the llvm-commits mailing list