Skip to content

Commit c0d64ba

Browse files
authored
Merge pull request swiftlang#77427 from mikeash/lazy-realization-weak-check
[Runtime] Weak-check _objc_supportsLazyRealization.
2 parents fb0b3fa + 7ef7f99 commit c0d64ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

stdlib/public/runtime/SwiftObject.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,11 +1380,19 @@ id swift_dynamicCastObjCProtocolConditional(id object,
13801380
return object;
13811381
}
13821382

1383+
#if OBJC_SUPPORTSLAZYREALIZATION_DEFINED
1384+
static bool checkObjCSupportsLazyRealization() {
1385+
if (!SWIFT_RUNTIME_WEAK_CHECK(_objc_supportsLazyRealization))
1386+
return false;
1387+
return SWIFT_RUNTIME_WEAK_USE(_objc_supportsLazyRealization());
1388+
}
1389+
#endif
1390+
13831391
// Check whether the current ObjC runtime supports lazy realization. If it does,
13841392
// then we can avoid forcing realization of classes before we use them.
13851393
static bool objcSupportsLazyRealization() {
13861394
#if OBJC_SUPPORTSLAZYREALIZATION_DEFINED
1387-
return SWIFT_LAZY_CONSTANT(_objc_supportsLazyRealization());
1395+
return SWIFT_LAZY_CONSTANT(checkObjCSupportsLazyRealization());
13881396
#else
13891397
return false;
13901398
#endif

0 commit comments

Comments
 (0)