diff options
| author | Glenn Smith <glenn@vector35.com> | 2025-07-31 17:25:18 -0400 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-08-01 21:37:38 -0400 |
| commit | 0996601386125530284705160083919973992954 (patch) | |
| tree | 7895b9760de2b57f774662c519a04dded925aece /examples/workflows | |
| parent | 2060680204071270772751237542247038184451 (diff) | |
Support MLIL expr mappings in C++
Diffstat (limited to 'examples/workflows')
| -rw-r--r-- | examples/workflows/unflatten/library.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/workflows/unflatten/library.cpp b/examples/workflows/unflatten/library.cpp index 062b928e..cb4e9b9a 100644 --- a/examples/workflows/unflatten/library.cpp +++ b/examples/workflows/unflatten/library.cpp @@ -235,7 +235,7 @@ void RewriteAction(Ref<AnalysisContext> context, bool doIt) { node->SetHighlight(GetHighlightColor(RedHighlightColor)); } - else if (std::find_if(path.begin(), path.end(), [node](Ref<BasicBlock> b) { return b->GetStart() == node->GetBasicBlock()->GetStart(); }) != path.end()) + else if (std::find_if(path.begin(), path.end(), [node](const Ref<BasicBlock>& b) { return b->GetStart() == node->GetBasicBlock()->GetStart(); }) != path.end()) { node->SetHighlight(GetHighlightColor(GreenHighlightColor)); } @@ -286,7 +286,7 @@ void RewriteAction(Ref<AnalysisContext> context, bool doIt) // Copy instruction as-is auto copyBlockInstr = oldMLIL->GetInstruction(copyBlockInstrIndex); newMLIL->SetCurrentAddress(copyBlock->GetArchitecture(), copyBlockInstr.address); - newMLIL->AddInstruction(copyBlockInstr.CopyTo(newMLIL)); + newMLIL->AddInstruction(copyBlockInstr.CopyTo(newMLIL), copyBlockInstr); } } continue; @@ -295,7 +295,7 @@ void RewriteAction(Ref<AnalysisContext> context, bool doIt) // Otherwise, copy the instruction as-is newMLIL->SetCurrentAddress(block->GetArchitecture(), oldInstr.address); - newMLIL->AddInstruction(oldInstr.CopyTo(newMLIL)); + newMLIL->AddInstruction(oldInstr.CopyTo(newMLIL), oldInstr); } } @@ -350,7 +350,7 @@ void RewriteAction(Ref<AnalysisContext> context, bool doIt) { size_t destValue = oldInstr.GetDestExpr<MLIL_JUMP_TO>().GetValue().value; auto targets = oldInstr.GetTargets<MLIL_JUMP_TO>(); - if (std::find_if(targets.begin(), targets.end(), [&](std::pair<size_t, size_t> target) { + if (std::find_if(targets.begin(), targets.end(), [&](const std::pair<size_t, size_t>& target) { return target.first == destValue; }) != targets.end()) { auto oldTargetIndex = targets[destValue]; @@ -359,7 +359,7 @@ void RewriteAction(Ref<AnalysisContext> context, bool doIt) blockLabels[oldTargetIndex] = MediumLevelILLabel{}; } MediumLevelILLabel* targetLabel = &blockLabels[oldTargetIndex]; - newMLIL->AddInstruction(newMLIL->Goto(*targetLabel, oldInstr)); + newMLIL->AddInstruction(newMLIL->Goto(*targetLabel, oldInstr), oldInstr); continue; } } @@ -367,7 +367,7 @@ void RewriteAction(Ref<AnalysisContext> context, bool doIt) // Otherwise, copy the instruction as-is newMLIL->SetCurrentAddress(block->GetArchitecture(), oldInstr.address); - newMLIL->AddInstruction(oldInstr.CopyTo(newMLIL)); + newMLIL->AddInstruction(oldInstr.CopyTo(newMLIL), oldInstr); } } |
