aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-08-11 18:52:41 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-08-11 18:52:41 +0000
commit27372b4f1f402e95dd479ecf40c39ca71c15619f (patch)
tree94a9a3434fcf0b67836e5528395290dc5e8f344a
parent70141c2d11ba555ff5922d8b4a014be2f629e2ec (diff)
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
-rw-r--r--include/clang/AST/ASTConsumer.h5
-rw-r--r--lib/AST/ASTConsumer.cpp3
-rw-r--r--lib/Frontend/ASTUnit.cpp3
-rw-r--r--lib/Frontend/PCHReader.cpp4
4 files changed, 13 insertions, 2 deletions
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);
}
}