diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 0d7a51bfe737..4cce4a77b343 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -219,7 +219,7 @@ void MCJIT::generateCodeForModule(Module *M) { std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(LoadedObject.takeError(), OS); - report_fatal_error(Twine(OS.str())); + report_fatal_error(Twine(Buf)); } std::unique_ptr L = Dyld.loadObject(*LoadedObject.get()); diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp index f7852b0ca62e..f40d93fefb87 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp @@ -346,11 +346,11 @@ static Error registerJITLoaderPerfStartImpl() { // Need to open ourselves, because we need to hand the FD to OpenMarker() and // raw_fd_ostream doesn't expose the FD. using sys::fs::openFileForWrite; - if (auto EC = openFileForReadWrite(FilenameBuf.str(), Tentative.DumpFd, + if (auto EC = openFileForReadWrite(Filename, Tentative.DumpFd, sys::fs::CD_CreateNew, sys::fs::OF_None)) { std::string ErrStr; raw_string_ostream ErrStream(ErrStr); - ErrStream << "could not open JIT dump file " << FilenameBuf.str() << ": " + ErrStream << "could not open JIT dump file " << Filename << ": " << EC.message() << "\n"; return make_error(std::move(ErrStr), inconvertibleErrorCode()); } diff --git a/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp b/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp index cf9ed7dbff15..4d14a606b98b 100644 --- a/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp +++ b/llvm/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp @@ -199,10 +199,9 @@ PerfJITEventListener::PerfJITEventListener() // Need to open ourselves, because we need to hand the FD to OpenMarker() and // raw_fd_ostream doesn't expose the FD. using sys::fs::openFileForWrite; - if (auto EC = - openFileForReadWrite(FilenameBuf.str(), DumpFd, - sys::fs::CD_CreateNew, sys::fs::OF_None)) { - errs() << "could not open JIT dump file " << FilenameBuf.str() << ": " + if (auto EC = openFileForReadWrite(Filename, DumpFd, sys::fs::CD_CreateNew, + sys::fs::OF_None)) { + errs() << "could not open JIT dump file " << Filename << ": " << EC.message() << "\n"; return; } diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp index b98d455cea37..d3d3735e4ea5 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp @@ -304,10 +304,10 @@ private: if (auto E = TI.takeError()) { errs() << "Error obtaining instruction printer: " << toString(std::move(E)) << "\n"; - return std::make_pair(EvalResult(ErrMsgStream.str()), ""); + return; } Inst.dump_pretty(ErrMsgStream, TI->InstPrinter.get()); - return std::make_pair(EvalResult(ErrMsgStream.str()), ""); + return; }; if (OpIdx >= Inst.getNumOperands()) { @@ -319,7 +319,8 @@ private: << format("%i", Inst.getNumOperands()) << " operands.\nInstruction is:\n "; - return printInst(Symbol, Inst, ErrMsgStream); + printInst(Symbol, Inst, ErrMsgStream); + return {EvalResult(std::move(ErrMsg)), ""}; } const MCOperand &Op = Inst.getOperand(OpIdx); @@ -329,7 +330,8 @@ private: ErrMsgStream << "Operand '" << format("%i", OpIdx) << "' of instruction '" << Symbol << "' is not an immediate.\nInstruction is:\n "; - return printInst(Symbol, Inst, ErrMsgStream); + printInst(Symbol, Inst, ErrMsgStream); + return {EvalResult(std::move(ErrMsg)), ""}; } return std::make_pair(EvalResult(Op.getImm()), RemainingExpr); diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp index 736d9a3e056f..b4e088d53394 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp @@ -1257,7 +1257,7 @@ RuntimeDyldELF::processRelocationRef( std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(SymTypeOrErr.takeError(), OS); - report_fatal_error(Twine(OS.str())); + report_fatal_error(Twine(Buf)); } SymType = *SymTypeOrErr; } @@ -1277,7 +1277,7 @@ RuntimeDyldELF::processRelocationRef( std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(SectionOrErr.takeError(), OS); - report_fatal_error(Twine(OS.str())); + report_fatal_error(Twine(Buf)); } section_iterator si = *SectionOrErr; if (si == Obj.section_end()) diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h index c079d8896c1d..19e42253ab1d 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h @@ -30,7 +30,7 @@ static bool isThumbFunc(object::symbol_iterator Symbol, std::string Buf; raw_string_ostream OS(Buf); logAllUnhandledErrors(SymTypeOrErr.takeError(), OS); - report_fatal_error(Twine(OS.str())); + report_fatal_error(Twine(Buf)); } if (*SymTypeOrErr != object::SymbolRef::ST_Function)