diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-03-29 23:47:40 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-03-29 23:47:40 +0000 |
commit | b1631d9161ced5a90ec345aaa809ce971a77cf55 (patch) | |
tree | af5aca393b4e0d242ce51844fceb8b3dd20f738b /clang/lib/Frontend/CompilerInstance.cpp | |
parent | b81f1e0db354f87fde110a51d8def6e6910c7cdf (diff) | |
download | bcm5719-llvm-b1631d9161ced5a90ec345aaa809ce971a77cf55.tar.gz bcm5719-llvm-b1631d9161ced5a90ec345aaa809ce971a77cf55.zip |
[CrashReproducer] Cleanup and move functionality around in ModuleDependencyCollector. NFC
- Make ModuleDependencyCollector use the DependencyCollector interface
- Move some methods from ModuleDependencyListener to ModuleDependencyCollector
in order to share common functionality with other future possible
callbacks.
llvm-svn: 264808
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 14 |
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); } |