diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 14:48:57 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2014-03-01 14:48:57 +0000 |
| commit | 802ac72495558ab109f0ce407383ef3547d4ca59 (patch) | |
| tree | 9efacbc8b40e26410c630b6980071598275405aa /lib/Serialization/ModuleManager.cpp | |
| parent | edea9113ff3b36fe7939ab054e0db9ed9a3b9c3b (diff) | |
| download | clang-802ac72495558ab109f0ce407383ef3547d4ca59.tar.gz clang-802ac72495558ab109f0ce407383ef3547d4ca59.tar.bz2 clang-802ac72495558ab109f0ce407383ef3547d4ca59.tar.xz | |
[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
Diffstat (limited to 'lib/Serialization/ModuleManager.cpp')
| -rw-r--r-- | lib/Serialization/ModuleManager.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
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<ModuleFile *, bool> { - llvm::SmallPtrSet<ModuleFile *, 4> &Removed; - - public: - IsInModuleFileSet(llvm::SmallPtrSet<ModuleFile *, 4> &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<ModuleFile *, 4> victimSet(first, last); // Remove any references to the now-destroyed modules. - IsInModuleFileSet checkInSet(victimSet); + 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); } |
