From: Sebastian Redl Date: Wed, 11 Aug 2010 18:52:41 +0000 (+0000) Subject: Reintroduce the ASTConsumer/ASTUnit fix from r110610, it has nothing to do with the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27372b4f1f402e95dd479ecf40c39ca71c15619f;p=clang Reintroduce the ASTConsumer/ASTUnit fix from r110610, it has nothing to do with the breakage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110840 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/ASTConsumer.h b/include/clang/AST/ASTConsumer.h index b01f6c6001..3f964ad0e9 100644 --- a/include/clang/AST/ASTConsumer.h +++ b/include/clang/AST/ASTConsumer.h @@ -49,6 +49,11 @@ public: /// elements). Use Decl::getNextDeclarator() to walk the chain. virtual void HandleTopLevelDecl(DeclGroupRef D); + /// HandleInterestingDecl - Handle the specified interesting declaration. This + /// is called by the PCH reader when deserializing things that might interest + /// the consumer. The default implementation forwards to HandleTopLevelDecl. + virtual void HandleInterestingDecl(DeclGroupRef D); + /// HandleTranslationUnit - This method is called when the ASTs for entire /// translation unit have been parsed. virtual void HandleTranslationUnit(ASTContext &Ctx) {} diff --git a/lib/AST/ASTConsumer.cpp b/lib/AST/ASTConsumer.cpp index f37cbdea54..04a084a06a 100644 --- a/lib/AST/ASTConsumer.cpp +++ b/lib/AST/ASTConsumer.cpp @@ -17,3 +17,6 @@ using namespace clang; void ASTConsumer::HandleTopLevelDecl(DeclGroupRef D) {} +void ASTConsumer::HandleInterestingDecl(DeclGroupRef D) { + HandleTopLevelDecl(D); +} diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index fe4768db7c..bbe2ec5bea 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -320,6 +320,9 @@ public: Unit.addTopLevelDecl(D); } } + + // We're not interested in "interesting" decls. + void HandleInterestingDecl(DeclGroupRef) {} }; class TopLevelDeclTrackerAction : public ASTFrontendAction { diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 1bfc138d4f..68acbb2faf 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -2262,7 +2262,7 @@ QualType PCHReader::ReadTypeRecord(unsigned Index) { SavedStreamPosition SavedPosition(DeclsCursor); ReadingKindTracker ReadingKind(Read_Type, *this); - + // Note that we are loading a type record. Deserializing AType(this); @@ -3027,7 +3027,7 @@ void PCHReader::PassInterestingDeclsToConsumer() { while (!InterestingDecls.empty()) { DeclGroupRef DG(InterestingDecls.front()); InterestingDecls.pop_front(); - Consumer->HandleTopLevelDecl(DG); + Consumer->HandleInterestingDecl(DG); } }