[PATCH] D25463: [Support][CommandLine] Display subcommands in help when there are less than 3 subcommands
Alex Lorenz via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 11 03:11:09 PDT 2016
arphaman created this revision.
arphaman added a reviewer: zturner.
arphaman added a subscriber: llvm-commits.
arphaman set the repository for this revision to rL LLVM.
This patch fixes a bug where the help output doesn't display subcommands when a tool has less than 3 subcommands.
Unfortunately I couldn't find a way to write a unittest for this change. Please let me know what's the best way to test this change (if any).
Repository:
rL LLVM
https://reviews.llvm.org/D25463
Files:
lib/Support/CommandLine.cpp
Index: lib/Support/CommandLine.cpp
===================================================================
--- lib/Support/CommandLine.cpp
+++ lib/Support/CommandLine.cpp
@@ -1778,7 +1778,7 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25463.74209.patch
Type: text/x-patch
Size: 519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161011/d376537a/attachment.bin>
More information about the llvm-commits
mailing list