Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions Frameworks/Foundation/NSObject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
#import "NSInvocationInternal.h"

static void _NSObjCEnumerationMutation(id object) {
[NSException raise:NSInternalInconsistencyException format:@"Collection <%s %p> mutated while being enumerated!", object_getClassName(object), object];
[NSException raise:NSInternalInconsistencyException
format:@"Collection <%s %p> mutated while being enumerated!", object_getClassName(object), object];
}

static BOOL _NSSelectorNotFoundIsNonFatal;
Expand Down Expand Up @@ -195,20 +196,25 @@ static id _NSWeakLoad(id obj) {
return obj;
}

// clang format doesn't play well with 'class' here, so turn it off
// clang-format off

/**
@Status Interoperable
*/
- (Class) class {
return object_getClass(self);
}

/**
@Status Interoperable
*/
- (Class)superclass {
return class_getSuperclass(object_getClass(self));
/**
@Status Interoperable
*/
- (Class)superclass {
return class_getSuperclass([self class]);
}

// clang-format on

/**
@Status Interoperable
*/
Expand Down Expand Up @@ -258,28 +264,28 @@ - (BOOL)conformsToProtocol:(Protocol*)protocol {
@Status Interoperable
*/
- (id)performSelector:(SEL)selector {
return ((id (*)(id, SEL))objc_msgSend)(self, selector);
return ((id(*)(id, SEL))objc_msgSend)(self, selector);
}

/**
@Status Interoperable
*/
- (id)performSelector:(SEL)selector withObject:(id)obj1 {
return ((id (*)(id, SEL, id))objc_msgSend)(self, selector, obj1);
return ((id(*)(id, SEL, id))objc_msgSend)(self, selector, obj1);
}

/**
@Status Interoperable
*/
- (id)performSelector:(SEL)selector withObject:(id)obj1 withObject:(id)obj2 {
return ((id (*)(id, SEL, id, id))objc_msgSend)(self, selector, obj1, obj2);
return ((id(*)(id, SEL, id, id))objc_msgSend)(self, selector, obj1, obj2);
}

/**
@Status Interoperable
*/
- (id)performSelector:(SEL)selector withObject:(id)obj1 withObject:(id)obj2 withObject:(id)obj3 {
return ((id (*)(id, SEL, id, id, id))objc_msgSend)(self, selector, obj1, obj2, obj3);
return ((id(*)(id, SEL, id, id, id))objc_msgSend)(self, selector, obj1, obj2, obj3);
}

/**
Expand Down Expand Up @@ -504,7 +510,6 @@ static IMP _NSIMPForward(id object, SEL selector) {
return _NSSlotForward(object, selector)->method;
}


/**
@Status Interoperable
*/
Expand Down Expand Up @@ -557,7 +562,7 @@ - (id)mutableCopy {
@Status Interoperable
*/
+ (id)self {
return (id)self;
return self;
}

/**
Expand Down Expand Up @@ -677,12 +682,11 @@ + (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelec
}

/**
@Status Stub
@Status Interoperable
@Notes
*/
- (BOOL)isProxy {
UNIMPLEMENTED();
return StubReturn();
return NO;
}

- (id)autoContentAccessingProxy {
Expand All @@ -700,6 +704,7 @@ void WinObjC_SetMissingSelectorFatal(BOOL fatal) {
_NSSelectorNotFoundIsNonFatal = !fatal;
}

// clang-format off
#pragma region NSZombie Support
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-objc-isa-usage" // We are knowingly accessing ->isa directly.
Expand All @@ -709,6 +714,7 @@ void WinObjC_SetMissingSelectorFatal(BOOL fatal) {
@end

static void _dealloc_zombify(id self, SEL _cmd); // forward declaration
// clang-format on

static void _NSCFZombifyHook(id object) {
_dealloc_zombify(object, nullptr);
Expand Down Expand Up @@ -737,7 +743,7 @@ + (BOOL)isSubclassOfClass:(Class)classRef {
/**
@Status Interoperable
*/
- (void)doesNotRecognizeSelector: (SEL)selector {
- (void)doesNotRecognizeSelector:(SEL)selector {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then again, some of them are good ..

// NSZombie subclasses store the original class as a class variable. Retrieve it here.
Class oldIsa = reinterpret_cast<Class*>(object_getIndexedIvars(isa))[0];
THROW_NS_HR_MSG(HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE),
Expand All @@ -748,8 +754,7 @@ - (void)doesNotRecognizeSelector: (SEL)selector {
}
@end

static void
_dealloc_dispose(id self, SEL _cmd) {
static void _dealloc_dispose(id self, SEL _cmd) {
object_dispose(self);
}

Expand Down
Loading