@@ -774,7 +774,15 @@ void ModuleFile::lookupClassMember(ImportPath::Access accessPath,
774
774
// one.
775
775
if (name.isSimpleName ()) {
776
776
for (auto item : *iter) {
777
- auto vd = cast<ValueDecl>(getDecl (item.second ));
777
+ auto declOrError = getDeclChecked (item.second );
778
+ if (!declOrError) {
779
+ if (!getContext ().LangOpts .EnableDeserializationRecovery )
780
+ fatal (declOrError.takeError ());
781
+ consumeError (declOrError.takeError ());
782
+ continue ;
783
+ }
784
+
785
+ auto vd = cast<ValueDecl>(declOrError.get ());
778
786
auto dc = vd->getDeclContext ();
779
787
while (!dc->getParent ()->isModuleScopeContext ())
780
788
dc = dc->getParent ();
@@ -784,7 +792,15 @@ void ModuleFile::lookupClassMember(ImportPath::Access accessPath,
784
792
}
785
793
} else {
786
794
for (auto item : *iter) {
787
- auto vd = cast<ValueDecl>(getDecl (item.second ));
795
+ auto declOrError = getDeclChecked (item.second );
796
+ if (!declOrError) {
797
+ if (!getContext ().LangOpts .EnableDeserializationRecovery )
798
+ fatal (declOrError.takeError ());
799
+ consumeError (declOrError.takeError ());
800
+ continue ;
801
+ }
802
+
803
+ auto vd = cast<ValueDecl>(declOrError.get ());
788
804
if (!vd->getName ().matchesRef (name))
789
805
continue ;
790
806
@@ -800,7 +816,15 @@ void ModuleFile::lookupClassMember(ImportPath::Access accessPath,
800
816
}
801
817
802
818
for (auto item : *iter) {
803
- auto vd = cast<ValueDecl>(getDecl (item.second ));
819
+ auto declOrError = getDeclChecked (item.second );
820
+ if (!declOrError) {
821
+ if (!getContext ().LangOpts .EnableDeserializationRecovery )
822
+ fatal (declOrError.takeError ());
823
+ consumeError (declOrError.takeError ());
824
+ continue ;
825
+ }
826
+
827
+ auto vd = cast<ValueDecl>(declOrError.get ());
804
828
results.push_back (vd);
805
829
}
806
830
}
@@ -818,6 +842,8 @@ void ModuleFile::lookupClassMembers(ImportPath::Access accessPath,
818
842
for (auto item : list) {
819
843
auto decl = getDeclChecked (item.second );
820
844
if (!decl) {
845
+ if (!getContext ().LangOpts .EnableDeserializationRecovery )
846
+ fatal (decl.takeError ());
821
847
llvm::consumeError (decl.takeError ());
822
848
continue ;
823
849
}
@@ -839,6 +865,8 @@ void ModuleFile::lookupClassMembers(ImportPath::Access accessPath,
839
865
for (auto item : list) {
840
866
auto decl = getDeclChecked (item.second );
841
867
if (!decl) {
868
+ if (!getContext ().LangOpts .EnableDeserializationRecovery )
869
+ fatal (decl.takeError ());
842
870
llvm::consumeError (decl.takeError ());
843
871
continue ;
844
872
}
0 commit comments