[llvm] r283998 - [Support][CommandLine] Display subcommands in help when there are less than 3
Alex Lorenz via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 12 03:04:36 PDT 2016
Author: arphaman
Date: Wed Oct 12 05:04:35 2016
New Revision: 283998
URL: http://llvm.org/viewvc/llvm-project?rev=283998&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Support/CommandLine.cpp
Modified: llvm/trunk/lib/Support/CommandLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CommandLine.cpp?rev=283998&r1=283997&r2=283998&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CommandLine.cpp (original)
+++ llvm/trunk/lib/Support/CommandLine.cpp Wed Oct 12 05:04:35 2016
@@ -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)
More information about the llvm-commits
mailing list