Page MenuHomePhabricator

[CommandLine] Error message for incorrect PositionalEatArgs usage
ClosedPublic

Authored by loladiro on May 11 2018, 5:06 PM.

Details

Summary

bugpoint has several options specified as PositionalEatArgs to pass
options through to the underlying tool, e.g. -tool-args. The -help
message suggests the usage is: -tool-args=<string>. However, this is
misleading, because that's not how these arguments work. Rather than taking
a value, the option consumes all positional arguments until the next
recognized option (or all arguments if -- is specified at some point).
To make this slightly clearer, instead print the help as:

-tool-args <string>...                            - <tool arguments>...

Additionally, add an error if the user attempts to use a PositionalEatArgs
argument with a value, instead of silently ignoring it. Example:

./bin/bugpoint -tool-args=-mpcu=skylake-avx512
bugpoint: for the -tool-args option: This argument does not take a value.
    Instead, it consumes any positional arguments until the next recognized option.

Diff Detail

Repository
rL LLVM

Event Timeline

loladiro created this revision.May 11 2018, 5:06 PM
aprantl accepted this revision.May 11 2018, 5:12 PM

I suppose we could add a test for the erroneous case?

This revision is now accepted and ready to land.May 11 2018, 5:12 PM

Great, thanks!

This revision was automatically updated to reflect the committed changes.