Merge pull request #4256 from lioncash/anyof

PPCAnalyst: Compress loop into std::any_of
This commit is contained in:
JosJuice 2016-09-29 15:47:29 +02:00 committed by GitHub
commit a714460ee3
1 changed files with 4 additions and 10 deletions

View File

@ -191,16 +191,10 @@ static void AnalyzeFunction2(Symbol* func)
{ {
u32 flags = func->flags; u32 flags = func->flags;
bool nonleafcall = false; bool nonleafcall = std::any_of(func->calls.begin(), func->calls.end(), [](const auto& call) {
for (const SCall& c : func->calls) const Symbol* called_func = g_symbolDB.GetSymbolFromAddr(call.function);
{ return called_func && (called_func->flags & FFLAG_LEAF) == 0;
Symbol* called_func = g_symbolDB.GetSymbolFromAddr(c.function); });
if (called_func && (called_func->flags & FFLAG_LEAF) == 0)
{
nonleafcall = true;
break;
}
}
if (nonleafcall && !(flags & FFLAG_EVIL) && !(flags & FFLAG_RFI)) if (nonleafcall && !(flags & FFLAG_EVIL) && !(flags & FFLAG_RFI))
flags |= FFLAG_ONLYCALLSNICELEAFS; flags |= FFLAG_ONLYCALLSNICELEAFS;