This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by MaskRay on Nov 1 2018, 9:49 AM.

Details

Summary

Before:
% llvm-objcopy -help
...
--weaken-symbol=symbol Mark <symbol> as weak
--weaken-symbol symbol Mark <symbol> as weak

After:
% llvm-objcopy -help
...
--weaken-symbol=symbol Mark <symbol> as weak

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Nov 1 2018, 9:49 AM
MaskRay edited the summary of this revision. (Show Details)Nov 1 2018, 9:50 AM
jhenderson accepted this revision.Nov 1 2018, 10:11 AM

LGTM, although please make sure that the whitespace is tidied up a bit, to make the indentation consistent, and reduce the number of long lines.

tools/llvm-objcopy/ObjcopyOpts.td
10 ↗(On Diff #172154)

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.

93 ↗(On Diff #172154)

Something wacky has gone on with the spacing on this line...

This revision is now accepted and ready to land.Nov 1 2018, 10:11 AM
MaskRay updated this revision to Diff 172163.Nov 1 2018, 10:21 AM
MaskRay marked an inline comment as done.

Update

MaskRay marked an inline comment as done.Nov 1 2018, 10:21 AM
This revision was automatically updated to reflect the committed changes.

--help is getting to the point where it might be clean enough to write a test for :)

tools/llvm-objcopy/ObjcopyOpts.td
10 ↗(On Diff #172154)

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)

MaskRay added inline comments.Nov 1 2018, 10:52 AM
tools/llvm-objcopy/ObjcopyOpts.td
10 ↗(On Diff #172154)

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
rupprecht added inline comments.Nov 1 2018, 11:59 AM
tools/llvm-objcopy/ObjcopyOpts.td
10 ↗(On Diff #172154)

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.