r344098 - [Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..."
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 9 17:15:33 PDT 2018
Author: maskray
Date: Tue Oct 9 17:15:33 2018
New Revision: 344098
URL: http://llvm.org/viewvc/llvm-project?rev=344098&view=rev
Log:
[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
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
cfe/trunk/tools/driver/cc1as_main.cpp
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=344098&r1=344097&r2=344098&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 9 17:15:33 2018
@@ -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)
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);
}
Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=344098&r1=344097&r2=344098&view=diff
==============================================================================
--- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)
+++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Tue Oct 9 17:15:33 2018
@@ -183,7 +183,7 @@ bool ExecuteCompilerInvocation(CompilerI
// 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);
Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=344098&r1=344097&r2=344098&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Tue Oct 9 17:15:33 2018
@@ -534,7 +534,8 @@ int cc1as_main(ArrayRef<const char *> Ar
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;
More information about the cfe-commits
mailing list