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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293399
91177308-0d34-0410-b5e6-
96231b3b80d8
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());