]> granicus.if.org Git - clang/commitdiff
[C++11] Remove a now unnecessary use of std::function for a remove_if
authorChandler Carruth <chandlerc@gmail.com>
Mon, 3 Mar 2014 19:36:27 +0000 (19:36 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 3 Mar 2014 19:36:27 +0000 (19:36 +0000)
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

lib/Serialization/ModuleManager.cpp

index 201f8fadea617d602b2b62ff2e094b8eb3d53018..3513eba86024ceebd2310259c052b182f42d1276 100644 (file)
@@ -143,11 +143,10 @@ void ModuleManager::removeModules(ModuleIterator first, ModuleIterator last,
   llvm::SmallPtrSet<ModuleFile *, 4> victimSet(first, last);
 
   // Remove any references to the now-destroyed modules.
-  std::function<bool(ModuleFile *)> 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.