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. llvm-svn: 203208
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user