r202744 - [C++11] Remove a now unnecessary use of std::function for a remove_if

Chandler Carruth chandlerc at gmail.com
Mon Mar 3 11:36:27 PST 2014


Author: chandlerc
Date: Mon Mar  3 13:36:27 2014
New Revision: 202744

URL: http://llvm.org/viewvc/llvm-project?rev=202744&view=rev
Log:
[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.

Modified:
    cfe/trunk/lib/Serialization/ModuleManager.cpp

Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ModuleManager.cpp?rev=202744&r1=202743&r2=202744&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ModuleManager.cpp (original)
+++ cfe/trunk/lib/Serialization/ModuleManager.cpp Mon Mar  3 13:36:27 2014
@@ -143,11 +143,10 @@ void ModuleManager::removeModules(Module
   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.





More information about the cfe-commits mailing list