Skip to content

Commit 33cd639

Browse files
authored
Merge pull request #36240 from mikeash/fix-warnings-objc-api
[Runtime] Silence warnings on NULL checks of ObjC function addresses.
2 parents 55e5d69 + 7c1b968 commit 33cd639

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

stdlib/public/runtime/Metadata.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,13 +3029,6 @@ _swift_initClassMetadataImpl(ClassMetadata *self,
30293029
setUpObjCRuntimeGetImageNameFromClass();
30303030
}, nullptr);
30313031

3032-
#ifndef OBJC_REALIZECLASSFROMSWIFT_DEFINED
3033-
// Temporary workaround until _objc_realizeClassFromSwift is in the SDK.
3034-
static auto _objc_realizeClassFromSwift =
3035-
(Class (*)(Class _Nullable, void *_Nullable))
3036-
dlsym(RTLD_NEXT, "_objc_realizeClassFromSwift");
3037-
#endif
3038-
30393032
// Temporary workaround until objc_loadClassref is in the SDK.
30403033
static auto objc_loadClassref =
30413034
(Class (*)(void *))
@@ -3078,7 +3071,7 @@ _swift_initClassMetadataImpl(ClassMetadata *self,
30783071
// be safe to ignore the stub in this case.
30793072
if (stub != nullptr &&
30803073
objc_loadClassref != nullptr &&
3081-
_objc_realizeClassFromSwift != nullptr) {
3074+
&_objc_realizeClassFromSwift != nullptr) {
30823075
_objc_realizeClassFromSwift((Class) self, const_cast<void *>(stub));
30833076
} else {
30843077
swift_instantiateObjCClass(self);
@@ -3129,14 +3122,7 @@ _swift_updateClassMetadataImpl(ClassMetadata *self,
31293122
const TypeLayout * const *fieldTypes,
31303123
size_t *fieldOffsets,
31313124
bool allowDependency) {
3132-
#ifndef OBJC_REALIZECLASSFROMSWIFT_DEFINED
3133-
// Temporary workaround until _objc_realizeClassFromSwift is in the SDK.
3134-
static auto _objc_realizeClassFromSwift =
3135-
(Class (*)(Class _Nullable, void *_Nullable))
3136-
dlsym(RTLD_NEXT, "_objc_realizeClassFromSwift");
3137-
#endif
3138-
3139-
bool requiresUpdate = (_objc_realizeClassFromSwift != nullptr);
3125+
bool requiresUpdate = (&_objc_realizeClassFromSwift != nullptr);
31403126

31413127
// If we're on a newer runtime, we're going to be initializing the
31423128
// field offset vector. Realize the superclass metadata first, even

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ static void installGetClassHook() {
19481948

19491949
#pragma clang diagnostic push
19501950
#pragma clang diagnostic ignored "-Wunguarded-availability"
1951-
if (objc_setHook_getClass) {
1951+
if (&objc_setHook_getClass) {
19521952
objc_setHook_getClass(getObjCClassByMangledName, &OldGetClassHook);
19531953
}
19541954
#pragma clang diagnostic pop

0 commit comments

Comments
 (0)