From d68028789807429945c7852bbda4effa95bf7d21 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Wed, 12 Oct 2016 10:04:35 +0000 Subject: [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 --- llvm/lib/Support/CommandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Support/CommandLine.cpp') diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 756df942020..07114ddcb8f 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -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) -- cgit v1.2.3