From: Chandler Carruth Date: Mon, 3 Mar 2014 19:36:27 +0000 (+0000) Subject: [C++11] Remove a now unnecessary use of std::function for a remove_if X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50744c2e4370e5619e22834d67976c13a9f3b172;p=clang [C++11] Remove a now unnecessary use of std::function for a remove_if predicate. The wrapper used by SetVector was erroneously requiring an adaptable predicate. It has been fixed and we really don't want to require an indirect call for every predicate evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202744 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp index 201f8fadea..3513eba860 100644 --- a/lib/Serialization/ModuleManager.cpp +++ b/lib/Serialization/ModuleManager.cpp @@ -143,11 +143,10 @@ void ModuleManager::removeModules(ModuleIterator first, ModuleIterator last, llvm::SmallPtrSet victimSet(first, last); // Remove any references to the now-destroyed modules. - std::function checkInSet = [&](ModuleFile *MF) { - return victimSet.count(MF); - }; for (unsigned i = 0, n = Chain.size(); i != n; ++i) { - Chain[i]->ImportedBy.remove_if(checkInSet); + Chain[i]->ImportedBy.remove_if([&](ModuleFile *MF) { + return victimSet.count(MF); + }); } // Delete the modules and erase them from the various structures.