aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHReader.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-07 15:46:26 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-07 15:46:26 +0000
commitbb80a8e8887c1ec74ee135d4ad9455eafedf1508 (patch)
tree21da60bab3977bb855eeb7a5dd0d4a8a876625b9 /lib/Frontend/PCHReader.cpp
parent4aedb1cab1a731bfa5c82459669320a72b0d6e66 (diff)
Delay passing InterestingDecls to the Consumer until when we know we are not in recursive loading and the
declarations are fully initialized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHReader.cpp')
-rw-r--r--lib/Frontend/PCHReader.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 03a55367b4..2b7dcacd03 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -2692,6 +2692,15 @@ PCHReader::FindExternalVisibleDeclsByName(const DeclContext *DC,
return const_cast<DeclContext*>(DC)->lookup(Name);
}
+void PCHReader::PassInterestingDeclsToConsumer() {
+ assert(Consumer);
+ while (!InterestingDecls.empty()) {
+ DeclGroupRef DG(InterestingDecls.front());
+ InterestingDecls.pop_front();
+ Consumer->HandleTopLevelDecl(DG);
+ }
+}
+
void PCHReader::StartTranslationUnit(ASTConsumer *Consumer) {
this->Consumer = Consumer;
@@ -2699,15 +2708,12 @@ void PCHReader::StartTranslationUnit(ASTConsumer *Consumer) {
return;
for (unsigned I = 0, N = ExternalDefinitions.size(); I != N; ++I) {
- // Force deserialization of this decl, which will cause it to be passed to
- // the consumer (or queued).
+ // Force deserialization of this decl, which will cause it to be queued for
+ // passing to the consumer.
GetDecl(ExternalDefinitions[I]);
}
- for (unsigned I = 0, N = InterestingDecls.size(); I != N; ++I) {
- DeclGroupRef DG(InterestingDecls[I]);
- Consumer->HandleTopLevelDecl(DG);
- }
+ PassInterestingDeclsToConsumer();
}
void PCHReader::PrintStats() {
@@ -3340,6 +3346,11 @@ PCHReader::LoadingTypeOrDecl::~LoadingTypeOrDecl() {
true);
Reader.PendingIdentifierInfos.pop_front();
}
+
+ // We are not in recursive loading, so it's safe to pass the "interesting"
+ // decls to the consumer.
+ if (Reader.Consumer)
+ Reader.PassInterestingDeclsToConsumer();
}
Reader.CurrentlyLoadingTypeOrDecl = Parent;