summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-10-11 15:58:48 +0000
committerZachary Turner <zturner@google.com>2016-10-11 15:58:48 +0000
commit79f3333d3f04c26cde06a663dca7b79e1ac86345 (patch)
tree2746443c50b07fdaf2d0a87b30b9832f573f960d /llvm/lib/Support/CommandLine.cpp
parenta91da4ba47457f294aaf319d6113a4e9ea52cb90 (diff)
downloadbcm5719-llvm-79f3333d3f04c26cde06a663dca7b79e1ac86345.tar.gz
bcm5719-llvm-79f3333d3f04c26cde06a663dca7b79e1ac86345.zip
[cl] Don't print subcommand help when no subcommands present.
Previously we would print USAGE: <exe> [subcommand] [options] Even if no subcommands were present. This changes the output format to only print "[subcommand]" if there is at least one subcommand. Fixes llvm.org/pr30598 Patch by Serge Guelton llvm-svn: 283892
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 76bf45e8f51..756df942020 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -1756,10 +1756,12 @@ public:
if (!GlobalParser->ProgramOverview.empty())
outs() << "OVERVIEW: " << GlobalParser->ProgramOverview << "\n";
- if (Sub == &*TopLevelSubCommand)
- outs() << "USAGE: " << GlobalParser->ProgramName
- << " [subcommand] [options]";
- else {
+ if (Sub == &*TopLevelSubCommand) {
+ outs() << "USAGE: " << GlobalParser->ProgramName;
+ if (Subs.size() > 2)
+ outs() << " [subcommand]";
+ outs() << " [options]";
+ } else {
if (!Sub->getDescription().empty()) {
outs() << "SUBCOMMAND '" << Sub->getName()
<< "': " << Sub->getDescription() << "\n\n";
OpenPOWER on IntegriCloud