From 3d48296e403ca498122af53721fcb195903456fe Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sun, 9 Aug 2015 02:28:42 +0000 Subject: [PATCH] [modules] Attach dependency listeners to the module manager once when it's created, rather than creating and attaching a new listener each time we load a module file (yes, the old ones were kept around too!). No functionality change intended, but a bit more sanity. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244411 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInstance.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 9da69d4766..4e7b08ac79 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -1261,6 +1261,13 @@ void CompilerInstance::createModuleManager() { ModuleManager->InitializeSema(getSema()); if (hasASTConsumer()) ModuleManager->StartTranslationUnit(&getASTConsumer()); + + if (TheDependencyFileGenerator) + TheDependencyFileGenerator->AttachToASTReader(*ModuleManager); + if (ModuleDepCollector) + ModuleDepCollector->attachToASTReader(*ModuleManager); + for (auto &Listener : DependencyCollectors) + Listener->attachToASTReader(*ModuleManager); } } @@ -1420,15 +1427,6 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, if (!ModuleManager) createModuleManager(); - if (TheDependencyFileGenerator) - TheDependencyFileGenerator->AttachToASTReader(*ModuleManager); - - if (ModuleDepCollector) - ModuleDepCollector->attachToASTReader(*ModuleManager); - - for (auto &Listener : DependencyCollectors) - Listener->attachToASTReader(*ModuleManager); - llvm::Timer Timer; if (FrontendTimerGroup) Timer.init("Loading " + ModuleFileName, *FrontendTimerGroup); -- 2.40.0