mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #41647 from xymus/recover-from-anyobject-lookup
[Serialization] Recover from failures under AnyObjectLookup
This commit is contained in:
@@ -774,7 +774,15 @@ void ModuleFile::lookupClassMember(ImportPath::Access accessPath,
|
||||
// one.
|
||||
if (name.isSimpleName()) {
|
||||
for (auto item : *iter) {
|
||||
auto vd = cast<ValueDecl>(getDecl(item.second));
|
||||
auto declOrError = getDeclChecked(item.second);
|
||||
if (!declOrError) {
|
||||
if (!getContext().LangOpts.EnableDeserializationRecovery)
|
||||
fatal(declOrError.takeError());
|
||||
consumeError(declOrError.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
auto vd = cast<ValueDecl>(declOrError.get());
|
||||
auto dc = vd->getDeclContext();
|
||||
while (!dc->getParent()->isModuleScopeContext())
|
||||
dc = dc->getParent();
|
||||
@@ -784,7 +792,15 @@ void ModuleFile::lookupClassMember(ImportPath::Access accessPath,
|
||||
}
|
||||
} else {
|
||||
for (auto item : *iter) {
|
||||
auto vd = cast<ValueDecl>(getDecl(item.second));
|
||||
auto declOrError = getDeclChecked(item.second);
|
||||
if (!declOrError) {
|
||||
if (!getContext().LangOpts.EnableDeserializationRecovery)
|
||||
fatal(declOrError.takeError());
|
||||
consumeError(declOrError.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
auto vd = cast<ValueDecl>(declOrError.get());
|
||||
if (!vd->getName().matchesRef(name))
|
||||
continue;
|
||||
|
||||
@@ -800,7 +816,15 @@ void ModuleFile::lookupClassMember(ImportPath::Access accessPath,
|
||||
}
|
||||
|
||||
for (auto item : *iter) {
|
||||
auto vd = cast<ValueDecl>(getDecl(item.second));
|
||||
auto declOrError = getDeclChecked(item.second);
|
||||
if (!declOrError) {
|
||||
if (!getContext().LangOpts.EnableDeserializationRecovery)
|
||||
fatal(declOrError.takeError());
|
||||
consumeError(declOrError.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
auto vd = cast<ValueDecl>(declOrError.get());
|
||||
results.push_back(vd);
|
||||
}
|
||||
}
|
||||
@@ -818,6 +842,8 @@ void ModuleFile::lookupClassMembers(ImportPath::Access accessPath,
|
||||
for (auto item : list) {
|
||||
auto decl = getDeclChecked(item.second);
|
||||
if (!decl) {
|
||||
if (!getContext().LangOpts.EnableDeserializationRecovery)
|
||||
fatal(decl.takeError());
|
||||
llvm::consumeError(decl.takeError());
|
||||
continue;
|
||||
}
|
||||
@@ -839,6 +865,8 @@ void ModuleFile::lookupClassMembers(ImportPath::Access accessPath,
|
||||
for (auto item : list) {
|
||||
auto decl = getDeclChecked(item.second);
|
||||
if (!decl) {
|
||||
if (!getContext().LangOpts.EnableDeserializationRecovery)
|
||||
fatal(decl.takeError());
|
||||
llvm::consumeError(decl.takeError());
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user