From ee8648bdac07986a0f1ec897b02ec82a2f144d46 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 7 Aug 2015 23:01:33 +0000 Subject: Vendor import of llvm trunk r242221: https://llvm.org/svn/llvm-project/llvm/trunk@242221 --- lib/LibDriver/LibDriver.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'lib/LibDriver') diff --git a/lib/LibDriver/LibDriver.cpp b/lib/LibDriver/LibDriver.cpp index cb3278c716e6..b33a22ff0cf8 100644 --- a/lib/LibDriver/LibDriver.cpp +++ b/lib/LibDriver/LibDriver.cpp @@ -56,17 +56,13 @@ public: } -static std::string getOutputPath(llvm::opt::InputArgList *Args) { +static std::string getOutputPath(llvm::opt::InputArgList *Args, + const llvm::NewArchiveIterator &FirstMember) { if (auto *Arg = Args->getLastArg(OPT_out)) return Arg->getValue(); - for (auto *Arg : Args->filtered(OPT_INPUT)) { - if (!StringRef(Arg->getValue()).endswith_lower(".obj")) - continue; - SmallString<128> Val = StringRef(Arg->getValue()); - llvm::sys::path::replace_extension(Val, ".lib"); - return Val.str(); - } - llvm_unreachable("internal error"); + SmallString<128> Val = FirstMember.getNew(); + llvm::sys::path::replace_extension(Val, ".lib"); + return Val.str(); } static std::vector getSearchPaths(llvm::opt::InputArgList *Args, @@ -144,7 +140,10 @@ int llvm::libDriverMain(llvm::ArrayRef ArgsArr) { } std::pair Result = - llvm::writeArchive(getOutputPath(&Args), Members, /*WriteSymtab=*/true); + llvm::writeArchive(getOutputPath(&Args, Members[0]), Members, + /*WriteSymtab=*/true, object::Archive::K_GNU, + /*Deterministic*/ true); + if (Result.second) { if (Result.first.empty()) Result.first = ArgsArr[0]; -- cgit v1.3