]> granicus.if.org Git - llvm/commitdiff
[Support][CommandLine] Display subcommands in help when there are less than 3
authorAlex Lorenz <arphaman@gmail.com>
Wed, 12 Oct 2016 10:04:35 +0000 (10:04 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 12 Oct 2016 10:04:35 +0000 (10:04 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283998 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/CommandLine.cpp

index 756df942020631557dcb5f1890d2a4cce5363973..07114ddcb8f2ad49d62d11e74922c6803c72e2c6 100644 (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)