forked from OSchip/llvm-project
[PCH] Don't deserialize bodies of interesting decls while iterating
over them because more interesting decls can be added during body deserialization. Should fix msvc build tests. llvm-svn: 146824
This commit is contained in:
parent
eadf124d2b
commit
da32f5c422
|
@ -790,6 +790,8 @@ private:
|
||||||
void PassInterestingDeclsToConsumer();
|
void PassInterestingDeclsToConsumer();
|
||||||
void PassInterestingDeclToConsumer(Decl *D);
|
void PassInterestingDeclToConsumer(Decl *D);
|
||||||
|
|
||||||
|
void finishPendingActions();
|
||||||
|
|
||||||
/// \brief Produce an error diagnostic and return true.
|
/// \brief Produce an error diagnostic and return true.
|
||||||
///
|
///
|
||||||
/// This routine should only be used for fatal errors that have to
|
/// This routine should only be used for fatal errors that have to
|
||||||
|
|
|
@ -6024,56 +6024,64 @@ void ASTReader::ClearSwitchCaseIDs() {
|
||||||
SwitchCaseStmts.clear();
|
SwitchCaseStmts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ASTReader::finishPendingActions() {
|
||||||
|
while (!PendingIdentifierInfos.empty() ||
|
||||||
|
!PendingPreviousDecls.empty() ||
|
||||||
|
!PendingChainedObjCCategories.empty()) {
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ASTReader::FinishedDeserializing() {
|
void ASTReader::FinishedDeserializing() {
|
||||||
assert(NumCurrentElementsDeserializing &&
|
assert(NumCurrentElementsDeserializing &&
|
||||||
"FinishedDeserializing not paired with StartedDeserializing");
|
"FinishedDeserializing not paired with StartedDeserializing");
|
||||||
if (NumCurrentElementsDeserializing == 1) {
|
if (NumCurrentElementsDeserializing == 1) {
|
||||||
|
|
||||||
// Fully load the interesting decls, including deserializing their bodies,
|
while (Consumer && !InterestingDecls.empty()) {
|
||||||
// so that any other declarations that get referenced in the body will be
|
finishPendingActions();
|
||||||
// fully deserialized by the time we pass them to the consumer.
|
|
||||||
for (std::deque<Decl *>::iterator
|
|
||||||
I = InterestingDecls.begin(),
|
|
||||||
E = InterestingDecls.end(); I != E; ++I)
|
|
||||||
(*I)->getBody();
|
|
||||||
|
|
||||||
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"
|
// We are not in recursive loading, so it's safe to pass the "interesting"
|
||||||
// decls to the consumer.
|
// decls to the consumer.
|
||||||
if (Consumer && !InterestingDecls.empty()) {
|
Decl *D = InterestingDecls.front();
|
||||||
Decl *D = InterestingDecls.front();
|
InterestingDecls.pop_front();
|
||||||
InterestingDecls.pop_front();
|
|
||||||
|
|
||||||
PassInterestingDeclToConsumer(D);
|
// Fully load the interesting decls, including deserializing their
|
||||||
|
// bodies, so that any other declarations that get referenced in the
|
||||||
|
// body will be fully deserialized by the time we pass them to the
|
||||||
|
// consumer.
|
||||||
|
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
||||||
|
if (FD->doesThisDeclarationHaveABody()) {
|
||||||
|
FD->getBody();
|
||||||
|
finishPendingActions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ((Consumer && !InterestingDecls.empty()) ||
|
PassInterestingDeclToConsumer(D);
|
||||||
!PendingIdentifierInfos.empty() ||
|
}
|
||||||
!PendingPreviousDecls.empty() ||
|
|
||||||
!PendingChainedObjCCategories.empty());
|
finishPendingActions();
|
||||||
|
|
||||||
assert(PendingForwardRefs.size() == 0 &&
|
assert(PendingForwardRefs.size() == 0 &&
|
||||||
"Some forward refs did not get linked to the definition!");
|
"Some forward refs did not get linked to the definition!");
|
||||||
|
|
Loading…
Reference in New Issue