-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,13 +137,20 @@ - (void)setupForwarderForSelector:(SEL)selector | |
Method originalMethod = class_getInstanceMethod([self mockedClass], selector); | ||
IMP originalImp = method_getImplementation(originalMethod); | ||
|
||
IMP forwarderImp; | ||
|
||
#if defined(__LP64__) && __LP64__ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dodikk
Author
Owner
|
||
forwarderImp = class_getMethodImplementation(subclass, @selector(aMethodThatMustNotExist)); | ||
#else | ||
NSMethodSignature *signature = [[self mockedClass] instanceMethodSignatureForSelector:selector]; | ||
// TODO: below we shouldn't really use getTypeEncoding because that doesn't work for methods implemented with -forwardingTargetForSelector: | ||
IMP forwarderImp; | ||
|
||
|
||
if([signature usesSpecialStructureReturn]) | ||
forwarderImp = class_getMethodImplementation_stret(subclass, @selector(aMethodThatMustNotExist)); | ||
else | ||
forwarderImp = class_getMethodImplementation(subclass, @selector(aMethodThatMustNotExist)); | ||
#endif | ||
class_addMethod(subclass, method_getName(originalMethod), forwarderImp, method_getTypeEncoding(originalMethod)); | ||
|
||
SEL aliasSelector = NSSelectorFromString([OCMRealMethodAliasPrefix stringByAppendingString:NSStringFromSelector(selector)]); | ||
|
This is incorrect for x86_64; this change is specific to arm64.