[MC] Assume CommentStream is non-null in MCDisassembler::tryAdding*

AArch64/ARM/X86 call the two functions. CommentStream is always
initialized.
This commit is contained in:
Fangrui Song 2019-12-15 16:18:23 -08:00
parent 2b0256e49b
commit 1ea5ce6335
1 changed files with 3 additions and 5 deletions

View File

@ -27,18 +27,16 @@ bool MCDisassembler::tryAddingSymbolicOperand(MCInst &Inst, int64_t Value,
uint64_t Address, bool IsBranch,
uint64_t Offset,
uint64_t InstSize) const {
raw_ostream &cStream = CommentStream ? *CommentStream : nulls();
if (Symbolizer)
return Symbolizer->tryAddingSymbolicOperand(Inst, cStream, Value, Address,
IsBranch, Offset, InstSize);
return Symbolizer->tryAddingSymbolicOperand(
Inst, *CommentStream, Value, Address, IsBranch, Offset, InstSize);
return false;
}
void MCDisassembler::tryAddingPcLoadReferenceComment(int64_t Value,
uint64_t Address) const {
raw_ostream &cStream = CommentStream ? *CommentStream : nulls();
if (Symbolizer)
Symbolizer->tryAddingPcLoadReferenceComment(cStream, Value, Address);
Symbolizer->tryAddingPcLoadReferenceComment(*CommentStream, Value, Address);
}
void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) {