Index: lib/Support/CommandLine.cpp =================================================================== --- lib/Support/CommandLine.cpp +++ lib/Support/CommandLine.cpp @@ -1270,8 +1270,15 @@ // If this is a named positional argument, just remember that it is the // active one... - if (Handler->getFormattingFlag() == cl::Positional) + if (Handler->getFormattingFlag() == cl::Positional) { + if ((Handler->getMiscFlags() & PositionalEatsArgs) && !Value.empty()) { + Handler->error("This argument does not take a value.\n" + "\tInstead, it consumes any positional arguments until " + "the next recognized option."); + ErrorParsing = true; + } ActivePositionalArg = Handler; + } else ErrorParsing |= ProvideOption(Handler, ArgName, Value, argc, argv, i); } @@ -1474,8 +1481,12 @@ size_t basic_parser_impl::getOptionWidth(const Option &O) const { size_t Len = O.ArgStr.size(); auto ValName = getValueName(); - if (!ValName.empty()) - Len += getValueStr(O, ValName).size() + 3; + if (!ValName.empty()) { + size_t FormattingLen = 3; + if (O.getMiscFlags() & PositionalEatsArgs) + FormattingLen = 6; + Len += getValueStr(O, ValName).size() + FormattingLen; + } return Len + 6; } @@ -1488,8 +1499,13 @@ outs() << " -" << O.ArgStr; auto ValName = getValueName(); - if (!ValName.empty()) - outs() << "=<" << getValueStr(O, ValName) << '>'; + if (!ValName.empty()) { + if (O.getMiscFlags() & PositionalEatsArgs) { + outs() << " <" << getValueStr(O, ValName) << ">..."; + } else { + outs() << "=<" << getValueStr(O, ValName) << '>'; + } + } Option::printHelpStr(O.HelpStr, GlobalWidth, getOptionWidth(O)); }