[PATCH] D78894: [ms] Add new option to llvm-lib: /llvmlibempty

Eric Astor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 12:54:21 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe9827f0b8275: [ms] Add new option to llvm-lib: /llvmlibempty (authored by epastor).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78894/new/

https://reviews.llvm.org/D78894

Files:
  llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
  llvm/lib/ToolDrivers/llvm-lib/Options.td
  llvm/test/tools/llvm-lib/no-inputs.test


Index: llvm/test/tools/llvm-lib/no-inputs.test
===================================================================
--- llvm/test/tools/llvm-lib/no-inputs.test
+++ llvm/test/tools/llvm-lib/no-inputs.test
@@ -1,2 +1,6 @@
 RUN: llvm-lib -out:%t.a
 RUN: test ! -e %t.a
+
+RUN: llvm-lib /llvmlibempty -out:%t.a
+RUN: FileCheck %s < %t.a
+CHECK: !<arch>
Index: llvm/lib/ToolDrivers/llvm-lib/Options.td
===================================================================
--- llvm/lib/ToolDrivers/llvm-lib/Options.td
+++ llvm/lib/ToolDrivers/llvm-lib/Options.td
@@ -18,6 +18,9 @@
 def llvmlibthin : F<"llvmlibthin">,
     HelpText<"Make .lib point to .obj files instead of copying their contents">;
 
+def llvmlibempty : F<"llvmlibempty">,
+    HelpText<"When given no contents, produce an empty .lib file">;
+
 def machine: P<"machine", "Specify target platform">;
 
 def help : F<"help">;
Index: llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
===================================================================
--- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
+++ llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
@@ -292,8 +292,9 @@
     return 0;
   }
 
-  // If no input files, silently do nothing to match lib.exe.
-  if (!Args.hasArgNoClaim(OPT_INPUT))
+  // If no input files and not told otherwise, silently do nothing to match
+  // lib.exe
+  if (!Args.hasArgNoClaim(OPT_INPUT) && !Args.hasArg(OPT_llvmlibempty))
     return 0;
 
   if (Args.hasArg(OPT_lst)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78894.261324.patch
Type: text/x-patch
Size: 1454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200430/2c308ed5/attachment.bin>


More information about the llvm-commits mailing list