[cfe-commits] r128664 - in /cfe/trunk: include/clang/Serialization/ChainedIncludesSource.h lib/Sema/SemaExprCXX.cpp lib/Serialization/ChainedIncludesSource.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Thu Mar 31 12:29:24 PDT 2011


Author: cornedbee
Date: Thu Mar 31 14:29:24 2011
New Revision: 128664

URL: http://llvm.org/viewvc/llvm-project?rev=128664&view=rev
Log:
Make ChainedIncludesSource an ExternalSemaSource, otherwise initialization of the ASTReader is incomplete, leading to errors like not realizing std::type_info is already defined.

Modified:
    cfe/trunk/include/clang/Serialization/ChainedIncludesSource.h
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp

Modified: cfe/trunk/include/clang/Serialization/ChainedIncludesSource.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ChainedIncludesSource.h?rev=128664&r1=128663&r2=128664&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ChainedIncludesSource.h (original)
+++ cfe/trunk/include/clang/Serialization/ChainedIncludesSource.h Thu Mar 31 14:29:24 2011
@@ -14,23 +14,23 @@
 #ifndef LLVM_CLANG_SERIALIZATION_CHAINEDINCLUDESSOURCE_H
 #define LLVM_CLANG_SERIALIZATION_CHAINEDINCLUDESSOURCE_H
 
-#include "clang/AST/ExternalASTSource.h"
+#include "clang/Sema/ExternalSemaSource.h"
 #include <vector>
 
 namespace clang {
   class CompilerInstance;
 
-class ChainedIncludesSource : public ExternalASTSource {
+class ChainedIncludesSource : public ExternalSemaSource {
 public:
   virtual ~ChainedIncludesSource();
 
   static ChainedIncludesSource *create(CompilerInstance &CI);
 
 private:
-  ExternalASTSource &getFinalReader() const { return *FinalReader; }
+  ExternalSemaSource &getFinalReader() const { return *FinalReader; }
 
   std::vector<CompilerInstance *> CIs;
-  llvm::OwningPtr<ExternalASTSource> FinalReader;
+  llvm::OwningPtr<ExternalSemaSource> FinalReader;
 
   
 protected:
@@ -56,6 +56,16 @@
   virtual void FinishedDeserializing();
   virtual void StartTranslationUnit(ASTConsumer *Consumer);
   virtual void PrintStats();
+
+//===----------------------------------------------------------------------===//
+// ExternalSemaSource interface.
+//===----------------------------------------------------------------------===//
+
+  virtual void InitializeSema(Sema &S);
+  virtual void ForgetSema();
+  virtual std::pair<ObjCMethodList,ObjCMethodList> ReadMethodPool(Selector Sel);
+  virtual bool LookupUnqualified(LookupResult &R, Scope *S);
+
 };
 
 }

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=128664&r1=128663&r2=128664&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Mar 31 14:29:24 2011
@@ -343,7 +343,7 @@
 Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
                      bool isType, void *TyOrExpr, SourceLocation RParenLoc) {
   // Find the std::type_info type.
-  if (!StdNamespace)
+  if (!getStdNamespace())
     return ExprError(Diag(OpLoc, diag::err_need_header_before_typeid));
 
   if (!CXXTypeInfoDecl) {

Modified: cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp?rev=128664&r1=128663&r2=128664&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp (original)
+++ cfe/trunk/lib/Serialization/ChainedIncludesSource.cpp Thu Mar 31 14:29:24 2011
@@ -208,3 +208,18 @@
 void ChainedIncludesSource::PrintStats() {
   return getFinalReader().PrintStats();
 }
+
+void ChainedIncludesSource::InitializeSema(Sema &S) {
+  return getFinalReader().InitializeSema(S);
+}
+void ChainedIncludesSource::ForgetSema() {
+  return getFinalReader().ForgetSema();
+}
+std::pair<ObjCMethodList,ObjCMethodList>
+ChainedIncludesSource::ReadMethodPool(Selector Sel) {
+  return getFinalReader().ReadMethodPool(Sel);
+}
+bool ChainedIncludesSource::LookupUnqualified(LookupResult &R, Scope *S) {
+  return getFinalReader().LookupUnqualified(R, S);
+}
+





More information about the cfe-commits mailing list