From 0996601386125530284705160083919973992954 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Thu, 31 Jul 2025 17:25:18 -0400 Subject: Support MLIL expr mappings in C++ --- examples/workflows/unflatten/library.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'examples/workflows/unflatten/library.cpp') 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 context, bool doIt) { node->SetHighlight(GetHighlightColor(RedHighlightColor)); } - else if (std::find_if(path.begin(), path.end(), [node](Ref b) { return b->GetStart() == node->GetBasicBlock()->GetStart(); }) != path.end()) + else if (std::find_if(path.begin(), path.end(), [node](const Ref& b) { return b->GetStart() == node->GetBasicBlock()->GetStart(); }) != path.end()) { node->SetHighlight(GetHighlightColor(GreenHighlightColor)); } @@ -286,7 +286,7 @@ void RewriteAction(Ref 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 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 context, bool doIt) { size_t destValue = oldInstr.GetDestExpr().GetValue().value; auto targets = oldInstr.GetTargets(); - if (std::find_if(targets.begin(), targets.end(), [&](std::pair target) { + if (std::find_if(targets.begin(), targets.end(), [&](const std::pair& target) { return target.first == destValue; }) != targets.end()) { auto oldTargetIndex = targets[destValue]; @@ -359,7 +359,7 @@ void RewriteAction(Ref 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 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); } } -- cgit v1.3.1