[lld] r191594 - [mach-o] Add support for -mllvm to darwin driver

Nick Kledzik kledzik at apple.com
Fri Sep 27 17:29:33 PDT 2013


Author: kledzik
Date: Fri Sep 27 19:29:33 2013
New Revision: 191594

URL: http://llvm.org/viewvc/llvm-project?rev=191594&view=rev
Log:
[mach-o] Add support for -mllvm to darwin driver

Modified:
    lld/trunk/lib/Driver/DarwinLdDriver.cpp
    lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp

Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=191594&r1=191593&r2=191594&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Fri Sep 27 19:29:33 2013
@@ -245,6 +245,13 @@ bool DarwinLdDriver::parse(int argc, con
     }
   }
 
+  // Handle -mllvm 
+  for (llvm::opt::arg_iterator it = parsedArgs->filtered_begin(OPT_mllvm),
+                               ie = parsedArgs->filtered_end();
+                               it != ie; ++it) {
+    ctx.appendLLVMOption((*it)->getValue());
+  }
+
   std::unique_ptr<InputGraph> inputGraph(new InputGraph());
 
   // Handle input files

Modified: lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp?rev=191594&r1=191593&r2=191594&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/DarwinLdDriverTest.cpp Fri Sep 27 19:29:33 2013
@@ -222,4 +222,13 @@ TEST_F(DarwinLdParserTest, deadStrippabl
   EXPECT_FALSE(parse("ld", "-mark_dead_strippable_dylib", "a.o", nullptr));
 }
 
+TEST_F(DarwinLdParserTest, llvmOptions) {
+  EXPECT_TRUE(parse("ld", "-mllvm", "-debug-only", "-mllvm", "foo", "a.o", nullptr));
+  const std::vector<const char *> &options = _context.llvmOptions();
+  EXPECT_EQ(options.size(), 2UL);
+  EXPECT_EQ(strcmp(options[0],"-debug-only"), 0);
+  EXPECT_EQ(strcmp(options[1],"foo"), 0);
+}
+
+
 }  // end anonymous namespace





More information about the llvm-commits mailing list