[RuntimeDyld] Use a raw_ostream and llvm::format for int-to-string conversions.

Some users' C++11 standard libraries don't support std::to_string yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211961 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames
2014-06-27 21:07:00 +00:00
parent d7be29696d
commit a677ffeb95

View File

@ -229,28 +229,28 @@ namespace llvm {
""); "");
unsigned OpIdx = OpIdxExpr.getValue(); unsigned OpIdx = OpIdxExpr.getValue();
if (OpIdx >= Inst.getNumOperands()) if (OpIdx >= Inst.getNumOperands()) {
return std::make_pair(EvalResult(("Invalid operand index '" + std::string ErrMsg;
std::to_string(OpIdx) + raw_string_ostream ErrMsgStream(ErrMsg);
" for instruction '" + Symbol + ErrMsgStream << "Invalid operand index '" << format("%i", OpIdx)
". Instruction has only " + << " for instruction '" << Symbol
std::to_string(Inst.getNumOperands()) << ". Instruction has only "
+ " operands.").str()), << format("%i", Inst.getNumOperands()) << " operands.";
""); return std::make_pair(EvalResult(ErrMsgStream.str()), "");
}
const MCOperand &Op = Inst.getOperand(OpIdx); const MCOperand &Op = Inst.getOperand(OpIdx);
if (!Op.isImm()) { if (!Op.isImm()) {
std::string InstrString; std::string ErrMsg;
raw_string_ostream InstrStringStream(InstrString); raw_string_ostream ErrMsgStream(ErrMsg);
Inst.dump_pretty(InstrStringStream, ErrMsgStream << "Operand '" << format("%i", OpIdx)
<< "' of instruction '" << Symbol
<< "' is not an immediate.\nInstruction is:\n ";
Inst.dump_pretty(ErrMsgStream,
Checker.Disassembler->getContext().getAsmInfo(), Checker.Disassembler->getContext().getAsmInfo(),
Checker.InstPrinter); Checker.InstPrinter);
return std::make_pair(EvalResult(("Operand '" + std::to_string(OpIdx) +
"' of instruction '" + Symbol + return std::make_pair(EvalResult(ErrMsgStream.str()), "");
"' is not an immediate.\n"
"Instruction is:\n " +
InstrStringStream.str()).str()),
"");
} }
return std::make_pair(EvalResult(Op.getImm()), RemainingExpr); return std::make_pair(EvalResult(Op.getImm()), RemainingExpr);