diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-30 23:18:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-30 23:18:26 +0000 |
commit | b9e53ed4e2f767ec86822e6923d2fc2bc1ea709a (patch) | |
tree | c1b7ebdd7567ac9a6f77d47e22d4ca3c65ca3992 /clang/lib/Serialization/ASTReader.cpp | |
parent | 8eeb3530718138b8b7d8ad436bfa318b1cdde895 (diff) | |
download | bcm5719-llvm-b9e53ed4e2f767ec86822e6923d2fc2bc1ea709a.tar.gz bcm5719-llvm-b9e53ed4e2f767ec86822e6923d2fc2bc1ea709a.zip |
[PCH] In ASTReader::FinishedDeserializing, after we do PassInterestingDeclsToConsumer
we may end up having added more pending stuff to do, so go in a loop until everything
is cleared out.
This fixes the error in rdar://10278815 which has a certain David Lynch-esque quality..
error: unknown type name 'BOOL'; did you mean 'BOOL'?
llvm-svn: 145536
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 72 |
1 files changed, 43 insertions, 29 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index af12bf39fab..95a73c31819 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -4531,13 +4531,17 @@ void ASTReader::PassInterestingDeclsToConsumer() { Decl *D = InterestingDecls.front(); InterestingDecls.pop_front(); - if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D)) - PassObjCImplDeclToConsumer(ImplD, Consumer); - else - Consumer->HandleInterestingDecl(DeclGroupRef(D)); + PassInterestingDeclToConsumer(D); } } +void ASTReader::PassInterestingDeclToConsumer(Decl *D) { + if (ObjCImplDecl *ImplD = dyn_cast<ObjCImplDecl>(D)) + PassObjCImplDeclToConsumer(ImplD, Consumer); + else + Consumer->HandleInterestingDecl(DeclGroupRef(D)); +} + void ASTReader::StartTranslationUnit(ASTConsumer *Consumer) { this->Consumer = Consumer; @@ -5693,33 +5697,43 @@ void ASTReader::FinishedDeserializing() { assert(NumCurrentElementsDeserializing && "FinishedDeserializing not paired with StartedDeserializing"); if (NumCurrentElementsDeserializing == 1) { - // If any identifiers with corresponding top-level declarations have - // been loaded, load those declarations now. - while (!PendingIdentifierInfos.empty()) { - SetGloballyVisibleDecls(PendingIdentifierInfos.front().II, - PendingIdentifierInfos.front().DeclIDs, true); - PendingIdentifierInfos.pop_front(); - } - - // Ready to load previous declarations of Decls that were delayed. - while (!PendingPreviousDecls.empty()) { - loadAndAttachPreviousDecl(PendingPreviousDecls.front().first, - PendingPreviousDecls.front().second); - PendingPreviousDecls.pop_front(); - } + do { + // If any identifiers with corresponding top-level declarations have + // been loaded, load those declarations now. + while (!PendingIdentifierInfos.empty()) { + SetGloballyVisibleDecls(PendingIdentifierInfos.front().II, + PendingIdentifierInfos.front().DeclIDs, true); + PendingIdentifierInfos.pop_front(); + } + + // Ready to load previous declarations of Decls that were delayed. + while (!PendingPreviousDecls.empty()) { + loadAndAttachPreviousDecl(PendingPreviousDecls.front().first, + PendingPreviousDecls.front().second); + PendingPreviousDecls.pop_front(); + } + + for (std::vector<std::pair<ObjCInterfaceDecl *, + serialization::DeclID> >::iterator + I = PendingChainedObjCCategories.begin(), + E = PendingChainedObjCCategories.end(); I != E; ++I) { + loadObjCChainedCategories(I->second, I->first); + } + PendingChainedObjCCategories.clear(); + + // We are not in recursive loading, so it's safe to pass the "interesting" + // decls to the consumer. + if (Consumer && !InterestingDecls.empty()) { + Decl *D = InterestingDecls.front(); + InterestingDecls.pop_front(); - for (std::vector<std::pair<ObjCInterfaceDecl *, - serialization::DeclID> >::iterator - I = PendingChainedObjCCategories.begin(), - E = PendingChainedObjCCategories.end(); I != E; ++I) { - loadObjCChainedCategories(I->second, I->first); - } - PendingChainedObjCCategories.clear(); + PassInterestingDeclToConsumer(D); + } - // We are not in recursive loading, so it's safe to pass the "interesting" - // decls to the consumer. - if (Consumer) - PassInterestingDeclsToConsumer(); + } while ((Consumer && !InterestingDecls.empty()) || + !PendingIdentifierInfos.empty() || + !PendingPreviousDecls.empty() || + !PendingChainedObjCCategories.empty()); assert(PendingForwardRefs.size() == 0 && "Some forward refs did not get linked to the definition!"); |