summaryrefslogtreecommitdiff
path: root/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2014-03-07 06:40:32 +0000
committerBen Langmuir <blangmuir@apple.com>2014-03-07 06:40:32 +0000
commit9f36327e3df8d2a4e89109b86eb610d84a13b4b9 (patch)
tree850d8f7a8f7ffbc1ab18cf3be7357efb5a740d48 /lib/Frontend/CompilerInstance.cpp
parent760c6c756172cb1671d1fc5203e99781914591e3 (diff)
downloadclang-9f36327e3df8d2a4e89109b86eb610d84a13b4b9.tar.gz
clang-9f36327e3df8d2a4e89109b86eb610d84a13b4b9.tar.bz2
clang-9f36327e3df8d2a4e89109b86eb610d84a13b4b9.tar.xz
Add dependencies from imported modules with -MD
Add module dependencies to the dependency files created by -MD/-MMD/etc. by attaching an ASTReaderListener that will call into the dependency file generator when a module input file is seen in the serialized AST. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203208 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInstance.cpp')
-rw-r--r--lib/Frontend/CompilerInstance.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index e07eb5295d..f10311a4ea 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -269,7 +269,8 @@ void CompilerInstance::createPreprocessor() {
// Handle generating dependencies, if requested.
const DependencyOutputOptions &DepOpts = getDependencyOutputOpts();
if (!DepOpts.OutputFile.empty())
- AttachDependencyFileGen(*PP, DepOpts);
+ TheDependencyFileGenerator.reset(
+ DependencyFileGenerator::CreateAndAttachToPreprocessor(*PP, DepOpts));
if (!DepOpts.DOTOutputFile.empty())
AttachDependencyGraphGen(*PP, DepOpts.DOTOutputFile,
getHeaderSearchOpts().Sysroot);
@@ -1160,6 +1161,9 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
ModuleManager->StartTranslationUnit(&getASTConsumer());
}
+ if (TheDependencyFileGenerator)
+ TheDependencyFileGenerator->AttachToASTReader(*ModuleManager);
+
// Try to load the module file.
unsigned ARRFlags = ASTReader::ARR_OutOfDate | ASTReader::ARR_Missing;
switch (ModuleManager->ReadAST(ModuleFileName, serialization::MK_Module,