[llvm][ExecutionEngine] Strip unneeded calls to raw_string_ostream::str() (NFC)
Avoid excess layer of indirection.
This commit is contained in:
@@ -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<RuntimeDyld::LoadedObjectInfo> L =
|
||||
Dyld.loadObject(*LoadedObject.get());
|
||||
|
||||
@@ -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<StringError>(std::move(ErrStr), inconvertibleErrorCode());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user