Give llvm-lib rudimentary help output.
authorNico Weber <nicolasweber@gmx.de>
Sat, 14 Jul 2018 02:29:44 +0000 (02:29 +0000)
committerNico Weber <nicolasweber@gmx.de>
Sat, 14 Jul 2018 02:29:44 +0000 (02:29 +0000)
https://reviews.llvm.org/D49318

llvm-svn: 337084

llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
llvm/lib/ToolDrivers/llvm-lib/Options.td
llvm/test/tools/llvm-lib/help.test [new file with mode: 0644]

index f5cf848..d636dca 100644 (file)
@@ -121,6 +121,12 @@ int llvm::libDriverMain(ArrayRef<const char *> 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;
index 5a56ef7..dd41952 100644 (file)
@@ -12,7 +12,11 @@ class P<string name, string help> :
 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<help>;
 
 //==============================================================================
 // The flags below do nothing. They are defined only for lib.exe compatibility.
diff --git a/llvm/test/tools/llvm-lib/help.test b/llvm/test/tools/llvm-lib/help.test
new file mode 100644 (file)
index 0000000..118219a
--- /dev/null
@@ -0,0 +1,3 @@
+# RUN: llvm-lib /? | FileCheck %s
+
+CHECK: OVERVIEW: LLVM Lib