diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-26 21:33:27 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-26 21:33:27 +0000 |
commit | 24ec769058dcb5ae86c3edfa4b8dee787d888763 (patch) | |
tree | 28e944c049ea6955d69d60c6d933d1087168334a | |
parent | 139cfc2e63ddb83a6e9ab668ea806597057f47a2 (diff) | |
download | bcm5719-llvm-24ec769058dcb5ae86c3edfa4b8dee787d888763.tar.gz bcm5719-llvm-24ec769058dcb5ae86c3edfa4b8dee787d888763.zip |
[frontend] Make -chain-include work when used with modules.
llvm-svn: 180633
-rw-r--r-- | clang/include/clang/Frontend/ChainedIncludesSource.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 1 | ||||
-rw-r--r-- | clang/lib/Frontend/ChainedIncludesSource.cpp | 1 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 2 |
4 files changed, 5 insertions, 1 deletions
diff --git a/clang/include/clang/Frontend/ChainedIncludesSource.h b/clang/include/clang/Frontend/ChainedIncludesSource.h index e14580ed69b..aa30460040a 100644 --- a/clang/include/clang/Frontend/ChainedIncludesSource.h +++ b/clang/include/clang/Frontend/ChainedIncludesSource.h @@ -26,9 +26,9 @@ public: static ChainedIncludesSource *create(CompilerInstance &CI); -private: ExternalSemaSource &getFinalReader() const { return *FinalReader; } +private: std::vector<CompilerInstance *> CIs; OwningPtr<ExternalSemaSource> FinalReader; diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index 0d674629fd4..d73a4280187 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -427,6 +427,7 @@ public: /// { ASTReader *getModuleManager() const { return ModuleManager; } + void setModuleManager(ASTReader *Reader) { ModuleManager = Reader; } /// } /// @name Code Completion diff --git a/clang/lib/Frontend/ChainedIncludesSource.cpp b/clang/lib/Frontend/ChainedIncludesSource.cpp index a17def0b37b..cde84caade5 100644 --- a/clang/lib/Frontend/ChainedIncludesSource.cpp +++ b/clang/lib/Frontend/ChainedIncludesSource.cpp @@ -143,6 +143,7 @@ ChainedIncludesSource *ChainedIncludesSource::create(CompilerInstance &CI) { Clang->getASTConsumer().GetASTDeserializationListener())); if (!Reader) return 0; + Clang->setModuleManager(static_cast<ASTReader*>(Reader.get())); Clang->getASTContext().setExternalSource(Reader); } diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 6031ad2b361..ece51a35707 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -294,6 +294,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, 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()) { |