[cfe-commits] Forwarding -l arguments to link.exe

Nikola Smiljanic popizdeh at gmail.com
Mon Jun 18 00:45:07 PDT 2012


Patch + test. I'm just not sure if the test should be called
msvc_forward or link_forward.
-------------- next part --------------
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp	(revision 158651)
+++ lib/Driver/Tools.cpp	(working copy)
@@ -5739,8 +5739,15 @@
 
   CmdArgs.push_back("-nologo");
 
-  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
+  Args.AddAllArgValues(CmdArgs, options::OPT_l);
 
+  // Add filenames immediately.
+  for (InputInfoList::const_iterator
+       it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) {
+    if (it->isFilename())
+      CmdArgs.push_back(it->getFilename());
+  }
+
   const char *Exec =
     Args.MakeArgString(getToolChain().GetProgramPath("link.exe"));
   C.addCommand(new Command(JA, *this, Exec, CmdArgs));
Index: test/Driver/msvc_forward.c
===================================================================
--- test/Driver/msvc_forward.c	(revision 0)
+++ test/Driver/msvc_forward.c	(working copy)
@@ -0,0 +1,5 @@
+// RUN: %clang -target i686-pc-win32 -lkernel32.lib -luser32.lib -### %s 2>&1 | FileCheck %s
+// CHECK-NOT: "-lkernel32.lib"
+// CHECK-NOT: "-luser32.lib"
+// CHECK: "kernel32.lib"
+// CHECK: "user32.lib"


More information about the cfe-commits mailing list