[PATCH] D31410: llvm-lto2: Move the LTO::run() action behind a subcommand.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 10:34:33 PDT 2017
pcc added a comment.
In https://reviews.llvm.org/D31410#723878, @zturner wrote:
> Actually perhaps better would be to make `cl::redefine` just another modifier. Maybe call it `cl::template_opt` or something. This way you would write:
>
> extern cl::opt<bool> UseNewLtoPm;
>
> cl::opt<bool> UseNewLtoPm2(cl::template_opt(UseNewLtoPm), cl::sub(RunSubcommand));
>
The problem with that (and your other suggestion) is that it would require specifying every possible flag to be passed to this tool. There are already quite a few of them that are required for tests (basically everything in llvm/CodeGen/CommandFlags.h and a few more). Also, as this is a developer tool I may also want to pass arbitrary top-level flags to the tool (e.g. for statistics, extra dumping, etc.) which may not already be covered by tests.
So I think I'd prefer that the API look something like like this (where `cl::import_root` imports all flags from the "root" subcommand into a given subcommand):
static cl::SubCommand RunSubcommand("run", "Run LTO", cl::import_root());
and use this hack until that is implemented.
https://reviews.llvm.org/D31410
More information about the llvm-commits
mailing list