aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 886595e..f8bc6a8 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1663,35 +1663,13 @@ size_t generic_parser_base::getOptionWidth(const Option &O) const {
void generic_parser_base::printOptionInfo(const Option &O,
size_t GlobalWidth) const {
if (O.hasArgStr()) {
- // When the value is optional, first print a line just describing the option
- // without values.
- if (O.getValueExpectedFlag() == ValueOptional) {
- for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
- if (getOption(i).empty()) {
- outs() << " -" << O.ArgStr;
- Option::printHelpStr(O.HelpStr, GlobalWidth, O.ArgStr.size() + 6);
- break;
- }
- }
- }
+ outs() << " -" << O.ArgStr;
+ Option::printHelpStr(O.HelpStr, GlobalWidth, O.ArgStr.size() + 6);
- outs() << " -" << O.ArgStr << "=<value>";
- Option::printHelpStr(O.HelpStr, GlobalWidth, O.ArgStr.size() + 14);
for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {
- StringRef ValueName = getOption(i);
- StringRef Description = getDescription(i);
- if (O.getValueExpectedFlag() == ValueOptional && ValueName.empty() &&
- Description.empty())
- continue;
- size_t NumSpaces = GlobalWidth - ValueName.size() - 8;
- outs() << " =" << ValueName;
- if (ValueName.empty()) {
- outs() << "<empty>";
- NumSpaces -= 7;
- }
- if (!Description.empty())
- outs().indent(NumSpaces) << " - " << Description;
- outs() << '\n';
+ size_t NumSpaces = GlobalWidth - getOption(i).size() - 8;
+ outs() << " =" << getOption(i);
+ outs().indent(NumSpaces) << " - " << getDescription(i) << '\n';
}
} else {
if (!O.HelpStr.empty())