From 03f7e611c625de0b5509ee975ca01ff95525a7b6 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. llvm-svn: 244411 --- clang/lib/Frontend/CompilerInstance.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 9da69d4..4e7b08a 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/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.7.4