From: Nico Weber Date: Sat, 14 Jul 2018 02:29:44 +0000 (+0000) Subject: Give llvm-lib rudimentary help output. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=981f0755e217d69c0f511626c5c24163660ce009;p=llvm Give llvm-lib rudimentary help output. https://reviews.llvm.org/D49318 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337084 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/lib/ToolDrivers/llvm-lib/LibDriver.cpp index f5cf848aa8c..d636dca7a2c 100644 --- a/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -121,6 +121,12 @@ int llvm::libDriverMain(ArrayRef ArgsArr) { for (auto *Arg : Args.filtered(OPT_UNKNOWN)) llvm::errs() << "ignoring unknown argument: " << Arg->getSpelling() << "\n"; + // Handle /help + if (Args.hasArg(OPT_help)) { + Table.PrintHelp(outs(), ArgsArr[0], "LLVM Lib"); + return 0; + } + // If no input files, silently do nothing to match lib.exe. if (!Args.hasArgNoClaim(OPT_INPUT)) return 0; diff --git a/lib/ToolDrivers/llvm-lib/Options.td b/lib/ToolDrivers/llvm-lib/Options.td index 5a56ef7468d..dd41952b787 100644 --- a/lib/ToolDrivers/llvm-lib/Options.td +++ b/lib/ToolDrivers/llvm-lib/Options.td @@ -12,7 +12,11 @@ class P : def libpath: P<"libpath", "Object file search path">; def out : P<"out", "Path to file to write output">; -def llvmlibthin : F<"llvmlibthin">; +def llvmlibthin : F<"llvmlibthin">, + HelpText<"Make .lib point to .obj files instead of copying their contents">; + +def help : F<"help">; +def help_q : Flag<["/?", "-?"], "">, Alias; //============================================================================== // The flags below do nothing. They are defined only for lib.exe compatibility. diff --git a/test/tools/llvm-lib/help.test b/test/tools/llvm-lib/help.test new file mode 100644 index 00000000000..118219a9284 --- /dev/null +++ b/test/tools/llvm-lib/help.test @@ -0,0 +1,3 @@ +# RUN: llvm-lib /? | FileCheck %s + +CHECK: OVERVIEW: LLVM Lib