@@ -1006,13 +1006,13 @@ ProtocolConformanceDeserializer::readNormalProtocolConformanceXRef(
1006
1006
auto error = llvm::make_error<ConformanceXRefError>(
1007
1007
nominal->getName (), proto->getName (), module );
1008
1008
1009
- if (!MF. enableExtendedDeserializationRecovery ()) {
1010
- error = llvm::handleErrors (std::move (error),
1011
- [&](const ConformanceXRefError &error) -> llvm::Error {
1012
- error.diagnose (&MF);
1013
- return llvm::make_error<ConformanceXRefError>(std::move (error));
1014
- });
1015
- }
1009
+ // Diagnose the root error here.
1010
+ error = llvm::handleErrors (std::move (error),
1011
+ [&](const ConformanceXRefError &error) -> llvm::Error {
1012
+ error.diagnose (&MF);
1013
+ return llvm::make_error<ConformanceXRefError>(std::move (error));
1014
+ });
1015
+
1016
1016
return error;
1017
1017
}
1018
1018
@@ -8899,23 +8899,27 @@ void ModuleFile::finishNormalConformance(NormalProtocolConformance *conformance,
8899
8899
if (maybeConformance) {
8900
8900
reqConformances.push_back (maybeConformance.get ());
8901
8901
} else if (getContext ().LangOpts .EnableDeserializationRecovery ) {
8902
- llvm::Error error = maybeConformance. takeError ();
8903
- if (error. isA <ConformanceXRefError>() &&
8904
- ! enableExtendedDeserializationRecovery ()) {
8902
+ // If a conformance is missing, mark the whole protocol conformance
8903
+ // as invalid. Something is broken with the context.
8904
+ conformance-> setInvalid ();
8905
8905
8906
+ llvm::Error error = maybeConformance.takeError ();
8907
+ if (error.isA <ConformanceXRefError>()) {
8908
+ // The error was printed along with creating the ConformanceXRefError.
8909
+ // Print the note here explaining the side effect.
8906
8910
std::string typeStr = conformance->getType ()->getString ();
8907
8911
auto &diags = getContext ().Diags ;
8908
8912
diags.diagnose (getSourceLoc (),
8909
8913
diag::modularization_issue_conformance_xref_note,
8910
8914
typeStr, proto->getName ());
8911
8915
8912
8916
consumeError (std::move (error));
8913
- conformance->setInvalid ();
8914
8917
return ;
8915
8918
}
8916
8919
8920
+ // Leave it up to the centralized service to report other errors.
8917
8921
diagnoseAndConsumeError (std::move (error));
8918
- reqConformances. push_back ( ProtocolConformanceRef::forInvalid ()) ;
8922
+ return ;
8919
8923
} else {
8920
8924
fatal (maybeConformance.takeError ());
8921
8925
}
0 commit comments