[Support][CommandLine] Display subcommands in help when there are less than 3

subcommands

This commit fixes a bug where the help output doesn't display subcommands when
a tool has less than 3 subcommands.

This change doesn't include a corresponding unittest as there is no viable way
to provide a unittest for it.

Differential Revision: https://reviews.llvm.org/D25463

llvm-svn: 283998
This commit is contained in:
Alex Lorenz 2016-10-12 10:04:35 +00:00
parent 1b9327f332
commit d680287898
1 changed files with 1 additions and 1 deletions

View File

@ -1780,7 +1780,7 @@ public:
if (ConsumeAfterOpt)
outs() << " " << ConsumeAfterOpt->HelpStr;
if (Sub == &*TopLevelSubCommand && Subs.size() > 2) {
if (Sub == &*TopLevelSubCommand && !Subs.empty()) {
// Compute the maximum subcommand length...
size_t MaxSubLen = 0;
for (size_t i = 0, e = Subs.size(); i != e; ++i)