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
This commit is contained in:
Duncan P. N. Exon Smith 2017-01-28 23:12:13 +00:00
parent 8e6bc1979d
commit 073ec35024
1 changed files with 3 additions and 3 deletions

View File

@ -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());