aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ModuleManager.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2017-01-28 23:12:13 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2017-01-28 23:12:13 +0000
commit073ec350242ddcf83ec434a2dc561a204bd05496 (patch)
tree1539af259c0322d2771d10e3ef78557c4888cdaf /clang/lib/Serialization/ModuleManager.cpp
parent8e6bc1979d342bffe98fdaa21f6925c2e289d561 (diff)
downloadllvm-073ec350242ddcf83ec434a2dc561a204bd05496.zip
llvm-073ec350242ddcf83ec434a2dc561a204bd05496.tar.gz
llvm-073ec350242ddcf83ec434a2dc561a204bd05496.tar.bz2
Modules: Clean up ModuleFile::Imports in ModuleManager::removeModules
I don't have a testcase for this (and I'm not sure if it's an observable bug), but it seems obviously wrong that ModuleManager::removeModules is failing to clean up deleted modules from ModuleFile::Imports. See the code in ModuleManager::addModule that inserts into ModuleFile::Imports; we need the inverse operation. llvm-svn: 293399
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r--clang/lib/Serialization/ModuleManager.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp
index 358dd0e..609eedf 100644
--- a/clang/lib/Serialization/ModuleManager.cpp
+++ b/clang/lib/Serialization/ModuleManager.cpp
@@ -204,10 +204,10 @@ void ModuleManager::removeModules(
return victimSet.count(MF);
};
// Remove any references to the now-destroyed modules.
- //
- // FIXME: this should probably clean up Imports as well.
- for (auto I = begin(); I != First; ++I)
+ for (auto I = begin(); I != First; ++I) {
+ I->Imports.remove_if(IsVictim);
I->ImportedBy.remove_if(IsVictim);
+ }
Roots.erase(std::remove_if(Roots.begin(), Roots.end(), IsVictim),
Roots.end());