mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +00:00
[Option] Support MultiArg in --help
Currently, if you use a MultiArg<> option, then printing out the help/usage message will cause an assert. This fixes getOptionHelpName() to work with MultiArg Options. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215770 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0549fc2448
commit
4a8a0f2132
@ -300,7 +300,18 @@ static std::string getOptionHelpName(const OptTable &Opts, OptSpecifier Id) {
|
||||
llvm_unreachable("Invalid option with help text.");
|
||||
|
||||
case Option::MultiArgClass:
|
||||
llvm_unreachable("Cannot print metavar for this kind of option.");
|
||||
if (const char *MetaVarName = Opts.getOptionMetaVar(Id)) {
|
||||
// For MultiArgs, metavar is full list of all argument names.
|
||||
Name += ' ';
|
||||
Name += MetaVarName;
|
||||
}
|
||||
else {
|
||||
// For MultiArgs<N>, if metavar not supplied, print <value> N times.
|
||||
for (unsigned i=0, e=O.getNumArgs(); i< e; ++i) {
|
||||
Name += " <value>";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Option::FlagClass:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user