File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
test/Serialization/Safety Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -885,8 +885,13 @@ void ModuleFile::lookupObjCMethods(
885
885
auto found = *known;
886
886
for (const auto &result : found) {
887
887
// Deserialize the method and add it to the list.
888
- if (auto func = dyn_cast_or_null<AbstractFunctionDecl>(
889
- getDecl (std::get<2 >(result))))
888
+ auto declOrError = getDeclChecked (std::get<2 >(result));
889
+ if (!declOrError) {
890
+ consumeError (declOrError.takeError ());
891
+ continue ;
892
+ }
893
+
894
+ if (auto func = dyn_cast_or_null<AbstractFunctionDecl>(declOrError.get ()))
890
895
results.push_back (func);
891
896
}
892
897
}
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-frontend -typecheck -verify %s \
2
+ // RUN: -enable-deserialization-safety \
3
+ // RUN: -Xllvm -debug-only=Serialization 2>&1 | %FileCheck %s
4
+
5
+ // REQUIRES: objc_interop
6
+ // REQUIRES: asserts
7
+
8
+ import Foundation
9
+
10
+ // Fails at reading __SwiftNativeNSEnumerator.init() on macOS.
11
+ NSString . instancesRespond ( to: " init " ) // expected-warning {{use of string literal for Objective-C selectors is deprecated; use '#selector' instead}}
12
+ // CHECK: Skipping unsafe deserialization: 'init()'
You can’t perform that action at this time.
0 commit comments