diff options
author | Ben Langmuir <blangmuir@apple.com> | 2014-06-30 20:04:14 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2014-06-30 20:04:14 +0000 |
commit | 33c8090a2f7f2e6d554f84a15a573a7ff7d3f59d (patch) | |
tree | b113aa17c51cca823bd7f4199507d87b48e80264 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 557c54d6ca95d0bf6569364b40e6ba6e0defa47f (diff) | |
download | bcm5719-llvm-33c8090a2f7f2e6d554f84a15a573a7ff7d3f59d.tar.gz bcm5719-llvm-33c8090a2f7f2e6d554f84a15a573a7ff7d3f59d.zip |
Consider module depedencies when checking a preamble in libclang
Add module dependencies (header files, module map files) to the list of
files to check when deciding whether to rebuild a preamble. That fixes
using preambles with module imports so long as they are in
non-overridden files.
My intent is to use to unify the existing dependency collectors to the
new “DependencyCollectory” interface from this commit, starting with the
DependencyFileGenerator.
llvm-svn: 212060
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index b5efb14dc2e..60f8ae8fdf0 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -288,6 +288,9 @@ 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()) @@ -1233,6 +1236,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, if (ModuleDepCollector) ModuleDepCollector->attachToASTReader(*ModuleManager); + for (auto &Listener : DependencyCollectors) + Listener->attachToASTReader(*ModuleManager); + // Try to load the module file. unsigned ARRFlags = ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing; switch (ModuleManager->ReadAST(ModuleFileName, serialization::MK_Module, |