summaryrefslogtreecommitdiff
path: root/highlevelilinstruction.cpp
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2022-02-04 22:04:52 -0500
committerRusty Wagner <rusty.wagner@gmail.com>2022-06-22 17:38:21 -0400
commitda250551336d916ad0058bf200e1f0b29ccb2a8f (patch)
treece0bd66003e2eda8f3b8ebc63bc623d265410df5 /highlevelilinstruction.cpp
parent63e72efd13b31c1d2061b978e2a5f4688e7ba4fd (diff)
Add unreachable instruction for switch statements with an unreachable default
Diffstat (limited to 'highlevelilinstruction.cpp')
-rw-r--r--highlevelilinstruction.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/highlevelilinstruction.cpp b/highlevelilinstruction.cpp
index 0e32673b..98c85ea2 100644
--- a/highlevelilinstruction.cpp
+++ b/highlevelilinstruction.cpp
@@ -66,7 +66,7 @@ unordered_map<HighLevelILOperandUsage, HighLevelILOperandType> HighLevelILInstru
unordered_map<BNHighLevelILOperation, vector<HighLevelILOperandUsage>>
HighLevelILInstructionBase::operationOperandUsage = {{HLIL_NOP, {}}, {HLIL_BREAK, {}}, {HLIL_CONTINUE, {}},
- {HLIL_NORET, {}}, {HLIL_BP, {}}, {HLIL_UNDEF, {}}, {HLIL_UNIMPL, {}},
+ {HLIL_NORET, {}}, {HLIL_BP, {}}, {HLIL_UNDEF, {}}, {HLIL_UNIMPL, {}}, {HLIL_UNREACHABLE, {}},
{HLIL_BLOCK, {BlockExprsHighLevelOperandUsage}},
{HLIL_IF, {ConditionExprHighLevelOperandUsage, TrueExprHighLevelOperandUsage, FalseExprHighLevelOperandUsage}},
{HLIL_WHILE, {ConditionExprHighLevelOperandUsage, LoopExprHighLevelOperandUsage}},
@@ -1371,6 +1371,8 @@ ExprId HighLevelILInstruction::CopyTo(
return dest->Return(params, *this);
case HLIL_NORET:
return dest->NoReturn(*this);
+ case HLIL_UNREACHABLE:
+ return dest->Unreachable(*this);
case HLIL_NEG:
case HLIL_NOT:
case HLIL_SX:
@@ -2451,6 +2453,12 @@ ExprId HighLevelILFunction::NoReturn(const ILSourceLocation& loc)
}
+ExprId HighLevelILFunction::Unreachable(const ILSourceLocation& loc)
+{
+ return AddExprWithLocation(HLIL_UNREACHABLE, loc, 0);
+}
+
+
ExprId HighLevelILFunction::Goto(uint64_t target, const ILSourceLocation& loc)
{
return AddExprWithLocation(HLIL_GOTO, loc, 0, target);