diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index c11806ff692a..10d2b9202b7c 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -8393,7 +8393,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA, for (StringRef LibName : BCLibs) CmdArgs.push_back(Args.MakeArgString( - "--target-library=" + Action::GetOffloadKindName(Action::OFK_OpenMP) + + "--bitcode-library=" + Action::GetOffloadKindName(Action::OFK_OpenMP) + "-" + TC->getTripleString() + "-" + Arch + "=" + LibName)); } diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 75e1a1b8a72c..06e5cf843da0 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -236,7 +236,7 @@ Expected createOutputFile(const Twine &Prefix, StringRef Extension) { return createFileError(OutputFile, EC); } - TempFiles.push_back(OutputFile); + TempFiles.emplace_back(std::move(OutputFile)); return TempFiles.back(); } @@ -771,16 +771,12 @@ std::unique_ptr createLTO( Conf.PTO.SLPVectorization = Conf.OptLevel > 1; if (SaveTemps) { - Conf.PostInternalizeModuleHook = [&, Arch](size_t, const Module &M) { - auto TempFileOrErr = - createOutputFile(sys::path::filename(ExecutableName) + "-" + - Triple.getTriple() + "-" + Arch, - "bc"); - if (!TempFileOrErr) - reportError(TempFileOrErr.takeError()); - + std::string TempName = (sys::path::filename(ExecutableName) + "-" + + Triple.getTriple() + "-" + Arch + ".bc") + .str(); + Conf.PostInternalizeModuleHook = [=](size_t, const Module &M) { std::error_code EC; - raw_fd_ostream LinkedBitcode(*TempFileOrErr, EC, sys::fs::OF_None); + raw_fd_ostream LinkedBitcode(TempName, EC, sys::fs::OF_None); if (EC) reportError(errorCodeToError(EC)); WriteBitcodeToFile(M, LinkedBitcode);