@@ -86,7 +86,7 @@ bool Workflow::rewriteMethodCall(LLILFunctionRef ssa, size_t insnIndex)
8686 const auto bv = function->GetView ();
8787 const auto llil = ssa->GetNonSSAForm ();
8888 const auto insn = ssa->GetInstruction (insnIndex);
89- const auto params = insn.GetParameterExprs <LLIL_CALL_SSA> ();
89+ const auto params = insn.GetParameterExprs ();
9090
9191 // The second parameter passed to the objc_msgSend call is the address of
9292 // either the selector reference or the method's name, which in both cases
@@ -254,12 +254,13 @@ void Workflow::inlineMethodCalls(AnalysisContextRef ac)
254254 const auto rewriteIfEligible = [bv, messageHandler, ssa](size_t insnIndex) {
255255 auto insn = ssa->GetInstruction (insnIndex);
256256
257- if (insn.operation == LLIL_CALL_SSA)
257+ if (insn.operation == LLIL_CALL_SSA || insn. operation == LLIL_TAILCALL_SSA )
258258 {
259259 // Filter out calls that aren't to `objc_msgSend`.
260- auto callExpr = insn.GetDestExpr <LLIL_CALL_SSA>();
261- bool isMessageSend = messageHandler->isMessageSend (callExpr.GetValue ().value );
262- if (auto symbol = bv->GetSymbolByAddress (callExpr.GetValue ().value ))
260+ auto callExpr = insn.GetDestExpr ();
261+ auto callTarget = callExpr.GetValue ().value ;
262+ bool isMessageSend = messageHandler->isMessageSend (callTarget);
263+ if (auto symbol = bv->GetSymbolByAddress (callTarget))
263264 isMessageSend = isMessageSend || symbol->GetRawName () == " _objc_msgSend" ;
264265 if (!isMessageSend)
265266 return false ;
@@ -294,7 +295,7 @@ void Workflow::registerActivities()
294295 const auto wf = BinaryNinja::Workflow::Instance (" core.function.baseAnalysis" )->Clone (" core.function.objectiveC" );
295296 wf->RegisterActivity (new BinaryNinja::Activity (
296297 ActivityID::ResolveMethodCalls, &Workflow::inlineMethodCalls));
297- wf->Insert (" core.function.translateTailCalls" , ActivityID::ResolveMethodCalls);
298+ wf->InsertAfter (" core.function.translateTailCalls" , ActivityID::ResolveMethodCalls);
298299
299300 BinaryNinja::Workflow::RegisterWorkflow (wf, WorkflowInfo);
300301}
0 commit comments