mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Use find_if to simplify control flow. NFC.
llvm-svn: 251200
This commit is contained in:
parent
bcf7364290
commit
d571fe502f
@ -107,18 +107,13 @@ static const AllocFnsTy *getAllocationData(const Value *V, AllocType AllocTy,
|
||||
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
|
||||
return nullptr;
|
||||
|
||||
unsigned i = 0;
|
||||
bool found = false;
|
||||
for ( ; i < array_lengthof(AllocationFnData); ++i) {
|
||||
if (AllocationFnData[i].Func == TLIFn) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
const AllocFnsTy *FnData =
|
||||
std::find_if(std::begin(AllocationFnData), std::end(AllocationFnData),
|
||||
[TLIFn](const AllocFnsTy &Fn) { return Fn.Func == TLIFn; });
|
||||
|
||||
if (FnData == std::end(AllocationFnData))
|
||||
return nullptr;
|
||||
|
||||
const AllocFnsTy *FnData = &AllocationFnData[i];
|
||||
if ((FnData->AllocTy & AllocTy) != FnData->AllocTy)
|
||||
return nullptr;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user