summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index a57023ad79a..cac73befff0 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -349,14 +349,18 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
AttachDependencyGraphGen(*PP, DepOpts.DOTOutputFile,
getHeaderSearchOpts().Sysroot);
- for (auto &Listener : DependencyCollectors)
- Listener->attachToPreprocessor(*PP);
-
// If we don't have a collector, but we are collecting module dependencies,
// then we're the top level compiler instance and need to create one.
- if (!ModuleDepCollector && !DepOpts.ModuleDependencyOutputDir.empty())
+ if (!ModuleDepCollector && !DepOpts.ModuleDependencyOutputDir.empty()) {
ModuleDepCollector = std::make_shared<ModuleDependencyCollector>(
DepOpts.ModuleDependencyOutputDir);
+ }
+
+ if (ModuleDepCollector)
+ addDependencyCollector(ModuleDepCollector);
+
+ for (auto &Listener : DependencyCollectors)
+ Listener->attachToPreprocessor(*PP);
// Handle generating header include information, if requested.
if (DepOpts.ShowHeaderIncludes)
@@ -1319,8 +1323,6 @@ void CompilerInstance::createModuleManager() {
if (TheDependencyFileGenerator)
TheDependencyFileGenerator->AttachToASTReader(*ModuleManager);
- if (ModuleDepCollector)
- ModuleDepCollector->attachToASTReader(*ModuleManager);
for (auto &Listener : DependencyCollectors)
Listener->attachToASTReader(*ModuleManager);
}
OpenPOWER on IntegriCloud