Author: dexonsmith Date: Sat Jan 28 17:12:13 2017 New Revision: 293399 URL: http://llvm.org/viewvc/llvm-project?rev=293399&view=rev Log: 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. Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp Modified: cfe/trunk/lib/Serialization/ModuleManager.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ModuleManager.cpp?rev=293399&r1=293398&r2=293399&view=diff ============================================================================== --- cfe/trunk/lib/Serialization/ModuleManager.cpp (original) +++ cfe/trunk/lib/Serialization/ModuleManager.cpp Sat Jan 28 17:12:13 2017 @@ -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()); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits