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

llvm-svn: 191594
This commit is contained in:
Nick Kledzik 2013-09-28 00:29:33 +00:00
parent 209b17cdaa
commit 0932c004a9
2 changed files with 16 additions and 0 deletions

View File

@ -245,6 +245,13 @@ bool DarwinLdDriver::parse(int argc, const char *argv[],
}
}
// 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

View File

@ -222,4 +222,13 @@ TEST_F(DarwinLdParserTest, deadStrippableDylibInvalidType) {
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