[PATCH] D62029: [LLD] [MinGW] Implement --help for the MinGW driver
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 04:06:27 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD361015: [MinGW] Implement --help for the MinGW driver (authored by mstorsjo, committed by ).
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62029/new/
https://reviews.llvm.org/D62029
Files:
MinGW/Driver.cpp
MinGW/Options.td
Index: MinGW/Options.td
===================================================================
--- MinGW/Options.td
+++ MinGW/Options.td
@@ -16,6 +16,7 @@
def export_all_symbols: F<"export-all-symbols">,
HelpText<"Export all symbols even if a def file or dllexport attributes are used">;
def gc_sections: F<"gc-sections">, HelpText<"Remove unused sections">;
+def help: F<"help">, HelpText<"Print option help">;
def icf: J<"icf=">, HelpText<"Identical code folding">;
def image_base: S<"image-base">, HelpText<"Base address of the program">;
def insert_timestamp: F<"insert-timestamp">,
Index: MinGW/Driver.cpp
===================================================================
--- MinGW/Driver.cpp
+++ MinGW/Driver.cpp
@@ -78,6 +78,13 @@
};
} // namespace
+static void printHelp(const char *Argv0) {
+ MinGWOptTable().PrintHelp(
+ outs(), (std::string(Argv0) + " [options] file...").c_str(), "lld",
+ false /*ShowHidden*/, true /*ShowAllAliases*/);
+ outs() << "\n";
+}
+
opt::InputArgList MinGWOptTable::parse(ArrayRef<const char *> Argv) {
unsigned MissingIndex;
unsigned MissingCount;
@@ -89,8 +96,6 @@
fatal(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
fatal("unknown argument: " + Arg->getSpelling());
- if (!Args.hasArg(OPT_INPUT) && !Args.hasArg(OPT_l))
- fatal("no input files");
return Args;
}
@@ -129,6 +134,14 @@
MinGWOptTable Parser;
opt::InputArgList Args = Parser.parse(ArgsArr.slice(1));
+ if (Args.hasArg(OPT_help)) {
+ printHelp(ArgsArr[0]);
+ return true;
+ }
+
+ if (!Args.hasArg(OPT_INPUT) && !Args.hasArg(OPT_l))
+ fatal("no input files");
+
std::vector<std::string> LinkArgs;
auto Add = [&](const Twine &S) { LinkArgs.push_back(S.str()); };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62029.200013.patch
Type: text/x-patch
Size: 1814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/2ebfef4c/attachment.bin>
More information about the llvm-commits
mailing list