r180633 - [frontend] Make -chain-include work when used with modules.

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Apr 26 14:33:27 PDT 2013


Author: akirtzidis
Date: Fri Apr 26 16:33:27 2013
New Revision: 180633

URL: http://llvm.org/viewvc/llvm-project?rev=180633&view=rev
Log:
[frontend] Make -chain-include work when used with modules.

Modified:
    cfe/trunk/include/clang/Frontend/ChainedIncludesSource.h
    cfe/trunk/include/clang/Frontend/CompilerInstance.h
    cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
    cfe/trunk/lib/Frontend/FrontendAction.cpp

Modified: cfe/trunk/include/clang/Frontend/ChainedIncludesSource.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ChainedIncludesSource.h?rev=180633&r1=180632&r2=180633&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ChainedIncludesSource.h (original)
+++ cfe/trunk/include/clang/Frontend/ChainedIncludesSource.h Fri Apr 26 16:33:27 2013
@@ -26,9 +26,9 @@ public:
 
   static ChainedIncludesSource *create(CompilerInstance &CI);
 
-private:
   ExternalSemaSource &getFinalReader() const { return *FinalReader; }
 
+private:
   std::vector<CompilerInstance *> CIs;
   OwningPtr<ExternalSemaSource> FinalReader;
 

Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=180633&r1=180632&r2=180633&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Fri Apr 26 16:33:27 2013
@@ -427,6 +427,7 @@ public:
   /// {
 
   ASTReader *getModuleManager() const { return ModuleManager; }
+  void setModuleManager(ASTReader *Reader) { ModuleManager = Reader; }
 
   /// }
   /// @name Code Completion

Modified: cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp?rev=180633&r1=180632&r2=180633&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp (original)
+++ cfe/trunk/lib/Frontend/ChainedIncludesSource.cpp Fri Apr 26 16:33:27 2013
@@ -143,6 +143,7 @@ ChainedIncludesSource *ChainedIncludesSo
         Clang->getASTConsumer().GetASTDeserializationListener()));
       if (!Reader)
         return 0;
+      Clang->setModuleManager(static_cast<ASTReader*>(Reader.get()));
       Clang->getASTContext().setExternalSource(Reader);
     }
     

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=180633&r1=180632&r2=180633&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Fri Apr 26 16:33:27 2013
@@ -294,6 +294,8 @@ bool FrontendAction::BeginSourceFile(Com
       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()) {





More information about the cfe-commits mailing list