From: Fangrui Song Date: Wed, 10 Oct 2018 00:15:33 +0000 (+0000) Subject: [Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..." X-Git-Tag: llvmorg-8.0.0-rc1~6928 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0028238302d6b673ac693cada423c77a1531e0b;p=platform%2Fupstream%2Fllvm.git [Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..." Summary: This is to accommodate a change in llvm/lib/Option/OptTable.cpp D51009 Reviewers: rupprecht, alexshap, jhenderson Reviewed By: rupprecht Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51109 llvm-svn: 344098 --- diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index ebf2ffc..203dcbe 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -68,6 +68,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/FormatVariadic.h" #include "llvm/Support/Path.h" #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" @@ -1433,7 +1434,8 @@ void Driver::PrintHelp(bool ShowHidden) const { if (!ShowHidden) ExcludedFlagsBitmask |= HelpHidden; - getOpts().PrintHelp(llvm::outs(), Name.c_str(), DriverTitle.c_str(), + std::string Usage = llvm::formatv("{0} [options] file...", Name).str(); + getOpts().PrintHelp(llvm::outs(), Usage.c_str(), DriverTitle.c_str(), IncludedFlagsBitmask, ExcludedFlagsBitmask, /*ShowAllAliases=*/false); } diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 2d3a211..e63a973 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -183,7 +183,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) { // Honor -help. if (Clang->getFrontendOpts().ShowHelp) { std::unique_ptr Opts = driver::createDriverOptTable(); - Opts->PrintHelp(llvm::outs(), "clang -cc1", + Opts->PrintHelp(llvm::outs(), "clang -cc1 [options] file...", "LLVM 'Clang' Compiler: http://clang.llvm.org", /*Include=*/driver::options::CC1Option, /*Exclude=*/0, /*ShowAllAliases=*/false); diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index 09db014..9e454cd 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -534,7 +534,8 @@ int cc1as_main(ArrayRef Argv, const char *Argv0, void *MainAddr) { if (Asm.ShowHelp) { std::unique_ptr Opts(driver::createDriverOptTable()); - Opts->PrintHelp(llvm::outs(), "clang -cc1as", "Clang Integrated Assembler", + Opts->PrintHelp(llvm::outs(), "clang -cc1as [options] file...", + "Clang Integrated Assembler", /*Include=*/driver::options::CC1AsOption, /*Exclude=*/0, /*ShowAllAliases=*/false); return 0;