/// deeply nested calls when there are many redeclarations.
std::deque<std::pair<Decl *, serialization::DeclID> > PendingPreviousDecls;
+ /// \brief We delay loading the chain of objc categories after recursive
+ /// loading of declarations is finished.
+ std::vector<std::pair<ObjCInterfaceDecl *, serialization::DeclID> >
+ PendingChainedObjCCategories;
+
/// \brief Ready to load the previous declaration of the given Decl.
void loadAndAttachPreviousDecl(Decl *D, serialization::DeclID ID);
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)
// Load any relevant update records.
loadDeclUpdateRecords(ID, D);
-
+
+ // Load the category chain after recursive loading is finished.
if (ObjCChainedCategoriesInterfaces.count(ID))
- loadObjCChainedCategories(ID, cast<ObjCInterfaceDecl>(D));
+ PendingChainedObjCCategories.push_back(
+ std::make_pair(cast<ObjCInterfaceDecl>(D), ID));
// If we have deserialized a declaration that has a definition the
// AST consumer might need to know about, queue it.