Reintroduce the ASTConsumer/ASTUnit fix from r110610, it has nothing to do with the breakage.

llvm-svn: 110840
This commit is contained in:
Sebastian Redl 2010-08-11 18:52:41 +00:00
parent 8c333153e0
commit eaa4ade80e
4 changed files with 13 additions and 2 deletions

View File

@ -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) {}

View File

@ -17,3 +17,6 @@ using namespace clang;
void ASTConsumer::HandleTopLevelDecl(DeclGroupRef D) {}
void ASTConsumer::HandleInterestingDecl(DeclGroupRef D) {
HandleTopLevelDecl(D);
}

View File

@ -320,6 +320,9 @@ public:
Unit.addTopLevelDecl(D);
}
}
// We're not interested in "interesting" decls.
void HandleInterestingDecl(DeclGroupRef) {}
};
class TopLevelDeclTrackerAction : public ASTFrontendAction {

View File

@ -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);
}
}