Make sure to flush the stream to make sure the string is up to date when we query its size.

llvm-svn: 247175
This commit is contained in:
Greg Clayton 2015-09-09 18:41:50 +00:00
parent 66dcafc3d6
commit aa61a1563b
1 changed files with 1 additions and 0 deletions

View File

@ -557,6 +557,7 @@ DisassemblerLLVMC::LLVMCDisassembler::PrintMCInst (llvm::MCInst &mc_inst,
llvm::raw_svector_ostream inst_stream(inst_string);
m_instr_printer_ap->printInst (&mc_inst, inst_stream, unused_annotations,
*m_subtarget_info_ap);
inst_stream.flush();
const size_t output_size = std::min(dst_len - 1, inst_string.size());
std::memcpy(dst, inst_string.data(), output_size);
dst[output_size] = '\0';