diff --git a/include/remill/Arch/Arch.h b/include/remill/Arch/Arch.h index e1936492..d7e865c6 100644 --- a/include/remill/Arch/Arch.h +++ b/include/remill/Arch/Arch.h @@ -288,12 +288,15 @@ class Arch { // The decoder takes contextual information in the form of a DecodingContext, making a copy to produce a ContextMap which is a function that maps // a successor to a new context that updates the old context. - virtual std::optional + + using DecodingResult = std::optional; + + virtual DecodingResult DecodeInstruction(uint64_t address, std::string_view instr_bytes, Instruction &inst, DecodingContext context) const = 0; // Decode an instruction that is within a delay slot. - std::optional + DecodingResult DecodeDelayedInstruction(uint64_t address, std::string_view instr_bytes, Instruction &inst, DecodingContext context) const { inst.in_delay_slot = true; diff --git a/lib/Arch/Arch.cpp b/lib/Arch/Arch.cpp index 43190a48..221cfa16 100644 --- a/lib/Arch/Arch.cpp +++ b/lib/Arch/Arch.cpp @@ -855,11 +855,9 @@ DecodingContext DefaultContextAndLifter::CreateInitialContext(void) const { return DecodingContext(); } -std::optional -DefaultContextAndLifter::DecodeInstruction(uint64_t address, - std::string_view instr_bytes, - Instruction &inst, - DecodingContext context) const { +Arch::DecodingResult DefaultContextAndLifter::DecodeInstruction( + uint64_t address, std::string_view instr_bytes, Instruction &inst, + DecodingContext context) const { inst.SetLifter(std::make_unique( this, this->GetInstrinsicTable())); if (this->ArchDecodeInstruction(address, instr_bytes, inst)) { diff --git a/lib/Arch/Sleigh/Arch.cpp b/lib/Arch/Sleigh/Arch.cpp index 9f336175..05ed5de3 100644 --- a/lib/Arch/Sleigh/Arch.cpp +++ b/lib/Arch/Sleigh/Arch.cpp @@ -366,7 +366,7 @@ std::string CustomLoadImage::getArchType(void) const { void CustomLoadImage::adjustVma(long) {} -std::optional +SleighArch::DecodingResult SleighArch::DecodeInstruction(uint64_t address, std::string_view instr_bytes, Instruction &inst, DecodingContext context) const {