mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialization: Recover from errors under loadObjCMethods
The diagnostics about unintended override of Objective-C methods deserializes more decls than strictly necessary. Any of these could trigger a deserialization failure if they rely on missing dependencies. Simply ignore methods failing to deserialize instead of crashing. We could do better here as this logic may ignore methods that are actually colliding. Instead we could put more information in the lookup table to avoid the need for fully deserializing the decl. rdar://138764733
This commit is contained in:
@@ -712,8 +712,15 @@ void ModuleFile::loadObjCMethods(
|
||||
continue;
|
||||
|
||||
// Deserialize the method and add it to the list.
|
||||
// Drop methods with errors.
|
||||
auto funcOrError = getDeclChecked(std::get<2>(result));
|
||||
if (!funcOrError) {
|
||||
diagnoseAndConsumeError(funcOrError.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto func = dyn_cast_or_null<AbstractFunctionDecl>(
|
||||
getDecl(std::get<2>(result)))) {
|
||||
funcOrError.get())) {
|
||||
methods.push_back(func);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user