From eea8d75638056aaffdab8b05279573ca0df443a3 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 23 Dec 2020 21:44:39 -0800 Subject: [PATCH] [ExecutionEngine, Linker] Use erase_if (NFC) --- lib/ExecutionEngine/SectionMemoryManager.cpp | 8 +++----- lib/Linker/IRMover.cpp | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/ExecutionEngine/SectionMemoryManager.cpp b/lib/ExecutionEngine/SectionMemoryManager.cpp index 138b18a1ddc..6690dd07d99 100644 --- a/lib/ExecutionEngine/SectionMemoryManager.cpp +++ b/lib/ExecutionEngine/SectionMemoryManager.cpp @@ -218,11 +218,9 @@ SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGroup, } // Remove all blocks which are now empty - MemGroup.FreeMem.erase(remove_if(MemGroup.FreeMem, - [](FreeMemBlock &FreeMB) { - return FreeMB.Free.allocatedSize() == 0; - }), - MemGroup.FreeMem.end()); + erase_if(MemGroup.FreeMem, [](FreeMemBlock &FreeMB) { + return FreeMB.Free.allocatedSize() == 0; + }); return std::error_code(); } diff --git a/lib/Linker/IRMover.cpp b/lib/Linker/IRMover.cpp index b7a9beeeeb1..5eeba0c0c3e 100644 --- a/lib/Linker/IRMover.cpp +++ b/lib/Linker/IRMover.cpp @@ -905,7 +905,7 @@ IRLinker::linkAppendingVarProto(GlobalVariable *DstGV, getArrayElements(SrcGV->getInitializer(), SrcElements); if (IsNewStructor) { - auto It = remove_if(SrcElements, [this](Constant *E) { + erase_if(SrcElements, [this](Constant *E) { auto *Key = dyn_cast(E->getAggregateElement(2)->stripPointerCasts()); if (!Key) @@ -913,7 +913,6 @@ IRLinker::linkAppendingVarProto(GlobalVariable *DstGV, GlobalValue *DGV = getLinkedToGlobal(Key); return !shouldLink(DGV, *Key); }); - SrcElements.erase(It, SrcElements.end()); } uint64_t NewSize = DstNumElements + SrcElements.size(); ArrayType *NewType = ArrayType::get(EltTy, NewSize);