From 802ac72495558ab109f0ce407383ef3547d4ca59 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 1 Mar 2014 14:48:57 +0000 Subject: [C++11] Replace verbose functors with succinct lambdas No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202590 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Serialization/ModuleManager.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'lib/Serialization/ModuleManager.cpp') diff --git a/lib/Serialization/ModuleManager.cpp b/lib/Serialization/ModuleManager.cpp index ce7e7af3d1..201f8fadea 100644 --- a/lib/Serialization/ModuleManager.cpp +++ b/lib/Serialization/ModuleManager.cpp @@ -134,22 +134,6 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, return NewModule? NewlyLoaded : AlreadyLoaded; } -namespace { - /// \brief Predicate that checks whether a module file occurs within - /// the given set. - class IsInModuleFileSet : public std::unary_function { - llvm::SmallPtrSet &Removed; - - public: - IsInModuleFileSet(llvm::SmallPtrSet &Removed) - : Removed(Removed) { } - - bool operator()(ModuleFile *MF) const { - return Removed.count(MF); - } - }; -} - void ModuleManager::removeModules(ModuleIterator first, ModuleIterator last, ModuleMap *modMap) { if (first == last) @@ -159,7 +143,9 @@ void ModuleManager::removeModules(ModuleIterator first, ModuleIterator last, llvm::SmallPtrSet victimSet(first, last); // Remove any references to the now-destroyed modules. - IsInModuleFileSet checkInSet(victimSet); + 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); } -- cgit v1.2.3