OSDN Git Service

[CommandLine] Error message for incorrect PositionalEatArgs usage
authorKeno Fischer <keno@alumni.harvard.edu>
Mon, 14 May 2018 23:26:06 +0000 (23:26 +0000)
committerKeno Fischer <keno@alumni.harvard.edu>
Mon, 14 May 2018 23:26:06 +0000 (23:26 +0000)
commit9897943c6c53e345c92e3e21e62f7eb42507f558
treebefd3567d4b3a26257f41a835582599d52f2f42d
parentb67613ea0a981186a192ed4431cf17f3ff4b59fb
[CommandLine] Error message for incorrect PositionalEatArgs usage

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.
```

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D46787

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332311 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/CommandLine.h
lib/Support/CommandLine.cpp
unittests/Support/CommandLineTest.cpp