]> granicus.if.org Git - clang/commitdiff
[Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..."
authorFangrui Song <maskray@google.com>
Wed, 10 Oct 2018 00:15:33 +0000 (00:15 +0000)
committerFangrui Song <maskray@google.com>
Wed, 10 Oct 2018 00:15:33 +0000 (00:15 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344098 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
lib/FrontendTool/ExecuteCompilerInvocation.cpp
tools/driver/cc1as_main.cpp

index ebf2ffc3558ffb15af9bb4972c023ec20c90adbc..203dcbe35f073d8b1e90572e7cd1aecf56c2e94d 100644 (file)
@@ -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);
 }
index 2d3a211558139081184c31b838a39d370c0a1194..e63a973845c8d9f518bdb7137485d984c66ea009 100644 (file)
@@ -183,7 +183,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) {
   // Honor -help.
   if (Clang->getFrontendOpts().ShowHelp) {
     std::unique_ptr<OptTable> 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);
index 09db014019bf09921e7f5b8c221f4d11c3bce4d6..9e454cdd0f4fd76e148ae0703eae14fe61b9e3f5 100644 (file)
@@ -534,7 +534,8 @@ int cc1as_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
 
   if (Asm.ShowHelp) {
     std::unique_ptr<OptTable> 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;