[PATCH] D54124: [llvm-readelf] Make llvm-readelf more compatible with GNU readelf.

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 5 23:15:35 PST 2018


phosek added a subscriber: silvas.
phosek added a comment.

In the "Migrating llvm-objdump and a few other common binutils replacements away from llvm::c" thread, @silvas said:

> The way I think about libOption vs cl:::opt is:
> 
> - cl::opt: use it for convenience and simplicity
> - libOption: use it for when you need to be compatible with a particular command line flag format.
> 
> My understanding is that cl::opt just doesn't have the fine-grained control needed for a truly production-quality command line interface compatible with some existing tool. I think this is a matter of correctness: is it a requirement to parse the command line options in the same way as some existing program? If so, then cl::opt probably isn't flexible enough. It may get you 90% of the way there, maybe 95%, but it will probably never truly feel native to users of the tool that it is intended to be compatible with.

I agree with him and after looking at this change, I'm convinced that llvm-readobj/llvm-readelf fits firmly into the latter category. We should consider migrating them to libOption in the future, although that's independent from this change.


Repository:
  rL LLVM

https://reviews.llvm.org/D54124





More information about the llvm-commits mailing list