[PATCH] D105532: [llvm-readobj] Switch command line parsing from llvm::cl to OptTable

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 11:37:50 PDT 2021


MaskRay added inline comments.


================
Comment at: llvm/tools/llvm-readobj/Opts.td:48
+// ELF specific options.
+def grp_elf : OptionGroup<"kind">, HelpText<"llvm-readobj ELF Specific Options">;
+def dynamic_table : FF<"dynamic-table", "Display the dynamic section table">, Group<grp_elf>;
----------------
MaskRay wrote:
> jhenderson wrote:
> > We should probably drop the "llvm-readobj" bit from these descriptions, as the tool is usually installed as "llvm-readelf" on people's systems, so the name would be incorrect there. Here, we can simply say "ELF Specific Options".
> The option groups are sorted alphabetically, so "ELF Specific Options" would be before "OPTIONS"... That's how the `llvm-readobj` prefix helps,  `OPTIONS` < `llvm-readobj ...`
I am going to use the `OPTIONS (ELF specific)` style for now.


================
Comment at: llvm/tools/llvm-readobj/Opts.td:50
+def dynamic_table : FF<"dynamic-table", "Display the dynamic section table">, Group<grp_elf>;
+def elf_hash_histogram : FF<"elf-hash-histogram", "Display bucket list histogram for hash sections">, Group<grp_elf>;
+def elf_linker_options : FF<"elf-linker-options", "Display the .linker-options section">, Group<grp_elf>;
----------------
jhenderson wrote:
> Does clang-format have a tablegen formatting option? This and a few other lines in this patch are getting quite long.
It does but the result isn't appealing. It may use many lines for some `def`s and the continuation positions are not consistent.
```
def section_mapping_EQ_false                                                                                
    : FF<"section-mapping=false",                                                                           
         "Don't display the section to segment mapping">,                                                           
      Flags<[HelpHidden]>;
...
def elf_hash_histogram : FF<"elf-hash-histogram",         
                            "Display bucket list histogram for hash sections">,                                     
                         Group<grp_elf>;                  
def elf_linker_options                                    
    : FF<"elf-linker-options", "Display the .linker-options section">,                                              
      Group<grp_elf>;                                     
defm elf_output_style : Eq<"elf-output-style", "Specify ELF dump style">,                                           
                        Group<grp_elf>;

```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105532



More information about the llvm-commits mailing list