[Serialization] Handle operators that can't be deserialized.

We were already doing this for top-level declarations; just use the
same recovery code for operators.

More rdar://problem/31920901
This commit is contained in:
Jordan Rose
2017-05-17 17:31:42 -07:00
parent e8229107ac
commit f30800ca49
2 changed files with 21 additions and 1 deletions

View File

@@ -1330,7 +1330,14 @@ void ModuleFile::lookupValue(DeclName name,
auto iter = OperatorMethodDecls->find(name.getBaseName());
if (iter != OperatorMethodDecls->end()) {
for (auto item : *iter) {
auto VD = cast<ValueDecl>(getDecl(item.second));
Expected<Decl *> declOrError = getDeclChecked(item.second);
if (!declOrError) {
if (!getContext().LangOpts.EnableDeserializationRecovery)
fatal(declOrError.takeError());
llvm::consumeError(declOrError.takeError());
continue;
}
auto VD = cast<ValueDecl>(declOrError.get());
results.push_back(VD);
}
}