[frontend] Make -chain-include work when used with modules.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180633 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/ChainedIncludesSource.cpp b/lib/Frontend/ChainedIncludesSource.cpp
index a17def0..cde84ca 100644
--- a/lib/Frontend/ChainedIncludesSource.cpp
+++ b/lib/Frontend/ChainedIncludesSource.cpp
@@ -143,6 +143,7 @@
Clang->getASTConsumer().GetASTDeserializationListener()));
if (!Reader)
return 0;
+ Clang->setModuleManager(static_cast<ASTReader*>(Reader.get()));
Clang->getASTContext().setExternalSource(Reader);
}
diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp
index 6031ad2..ece51a3 100644
--- a/lib/Frontend/FrontendAction.cpp
+++ b/lib/Frontend/FrontendAction.cpp
@@ -294,6 +294,8 @@
source.reset(ChainedIncludesSource::create(CI));
if (!source)
goto failure;
+ CI.setModuleManager(static_cast<ASTReader*>(
+ &static_cast<ChainedIncludesSource*>(source.get())->getFinalReader()));
CI.getASTContext().setExternalSource(source);
} else if (!CI.getPreprocessorOpts().ImplicitPCHInclude.empty()) {