@@ -10791,47 +10791,54 @@ void ASTReader::FinishedDeserializing() {
10791
10791
--NumCurrentElementsDeserializing;
10792
10792
10793
10793
if (NumCurrentElementsDeserializing == 0) {
10794
- // Propagate exception specification and deduced type updates along
10795
- // redeclaration chains.
10796
- //
10797
- // We do this now rather than in finishPendingActions because we want to
10798
- // be able to walk the complete redeclaration chains of the updated decls.
10799
- while (!PendingExceptionSpecUpdates.empty() ||
10800
- !PendingDeducedTypeUpdates.empty() ||
10801
- !PendingUndeducedFunctionDecls.empty()) {
10802
- auto ESUpdates = std::move(PendingExceptionSpecUpdates);
10803
- PendingExceptionSpecUpdates.clear();
10804
- for (auto Update : ESUpdates) {
10805
- ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
10806
- auto *FPT = Update.second->getType()->castAs<FunctionProtoType>();
10807
- auto ESI = FPT->getExtProtoInfo().ExceptionSpec;
10808
- if (auto *Listener = getContext().getASTMutationListener())
10809
- Listener->ResolvedExceptionSpec(cast<FunctionDecl>(Update.second));
10810
- for (auto *Redecl : Update.second->redecls())
10811
- getContext().adjustExceptionSpec(cast<FunctionDecl>(Redecl), ESI);
10812
- }
10794
+ {
10795
+ // Guard variable to avoid recursively entering the process of passing
10796
+ // decls to consumer.
10797
+ SaveAndRestore GuardPassingDeclsToConsumer(CanPassDeclsToConsumer, false);
10813
10798
10814
- auto DTUpdates = std::move(PendingDeducedTypeUpdates);
10815
- PendingDeducedTypeUpdates.clear();
10816
- for (auto Update : DTUpdates) {
10817
- ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
10818
- // FIXME: If the return type is already deduced, check that it matches.
10819
- getContext().adjustDeducedFunctionResultType(Update.first,
10820
- Update.second);
10821
- }
10799
+ // Propagate exception specification and deduced type updates along
10800
+ // redeclaration chains.
10801
+ //
10802
+ // We do this now rather than in finishPendingActions because we want to
10803
+ // be able to walk the complete redeclaration chains of the updated decls.
10804
+ while (!PendingExceptionSpecUpdates.empty() ||
10805
+ !PendingDeducedTypeUpdates.empty() ||
10806
+ !PendingUndeducedFunctionDecls.empty()) {
10807
+ auto ESUpdates = std::move(PendingExceptionSpecUpdates);
10808
+ PendingExceptionSpecUpdates.clear();
10809
+ for (auto Update : ESUpdates) {
10810
+ ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
10811
+ auto *FPT = Update.second->getType()->castAs<FunctionProtoType>();
10812
+ auto ESI = FPT->getExtProtoInfo().ExceptionSpec;
10813
+ if (auto *Listener = getContext().getASTMutationListener())
10814
+ Listener->ResolvedExceptionSpec(cast<FunctionDecl>(Update.second));
10815
+ for (auto *Redecl : Update.second->redecls())
10816
+ getContext().adjustExceptionSpec(cast<FunctionDecl>(Redecl), ESI);
10817
+ }
10822
10818
10823
- auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
10824
- PendingUndeducedFunctionDecls.clear();
10825
- // We hope we can find the deduced type for the functions by iterating
10826
- // redeclarations in other modules.
10827
- for (FunctionDecl *UndeducedFD : UDTUpdates)
10828
- (void)UndeducedFD->getMostRecentDecl();
10829
- }
10819
+ auto DTUpdates = std::move(PendingDeducedTypeUpdates);
10820
+ PendingDeducedTypeUpdates.clear();
10821
+ for (auto Update : DTUpdates) {
10822
+ ProcessingUpdatesRAIIObj ProcessingUpdates(*this);
10823
+ // FIXME: If the return type is already deduced, check that it
10824
+ // matches.
10825
+ getContext().adjustDeducedFunctionResultType(Update.first,
10826
+ Update.second);
10827
+ }
10830
10828
10831
- if (ReadTimer)
10832
- ReadTimer->stopTimer();
10829
+ auto UDTUpdates = std::move(PendingUndeducedFunctionDecls);
10830
+ PendingUndeducedFunctionDecls.clear();
10831
+ // We hope we can find the deduced type for the functions by iterating
10832
+ // redeclarations in other modules.
10833
+ for (FunctionDecl *UndeducedFD : UDTUpdates)
10834
+ (void)UndeducedFD->getMostRecentDecl();
10835
+ }
10833
10836
10834
- diagnoseOdrViolations();
10837
+ if (ReadTimer)
10838
+ ReadTimer->stopTimer();
10839
+
10840
+ diagnoseOdrViolations();
10841
+ }
10835
10842
10836
10843
// We are not in recursive loading, so it's safe to pass the "interesting"
10837
10844
// decls to the consumer.
0 commit comments