Compatibility fix for arm64 on iOS

Manually patches in 77400c22b5bafd8aaaa75f90a1d997838204577a from upstream.

Description:
  Also on arm64, BOOL seems to be encoded as "bool" (the 'B' objcType, or
  _C_BOOL) rather than the historical 'c', but NSValue can still use 'c',
  so we need to have those compare as equal.

BUG=314720

Review URL: https://codereview.chromium.org/177373009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255187 0039d316-1c4b-4281-b951-d872f2087c98
parent 841fd0bf
...@@ -161,6 +161,7 @@ ...@@ -161,6 +161,7 @@
switch(*argType) switch(*argType)
{ {
case '@': return [self objectDescriptionAtIndex:argIndex]; case '@': return [self objectDescriptionAtIndex:argIndex];
case 'B': return [self boolDescriptionAtIndex:argIndex];
case 'c': return [self charDescriptionAtIndex:argIndex]; case 'c': return [self charDescriptionAtIndex:argIndex];
case 'C': return [self unsignedCharDescriptionAtIndex:argIndex]; case 'C': return [self unsignedCharDescriptionAtIndex:argIndex];
case 'i': return [self intDescriptionAtIndex:argIndex]; case 'i': return [self intDescriptionAtIndex:argIndex];
...@@ -197,6 +198,14 @@ ...@@ -197,6 +198,14 @@
return [object description]; return [object description];
} }
- (NSString *)boolDescriptionAtIndex:(int)anInt
{
bool value;
[self getArgument:&value atIndex:anInt];
return value ? @"YES" : @"NO";
}
- (NSString *)charDescriptionAtIndex:(int)anInt - (NSString *)charDescriptionAtIndex:(int)anInt
{ {
unsigned char buffer[128]; unsigned char buffer[128];
......
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
- (void)handleInvocation:(NSInvocation *)anInvocation - (void)handleInvocation:(NSInvocation *)anInvocation
{ {
if(strcmp([[anInvocation methodSignature] methodReturnType], [(NSValue *)returnValue objCType]) != 0) const char* returnType = [[anInvocation methodSignature] methodReturnType];
const char* valueType = [(NSValue *)returnValue objCType];
// ARM64 uses 'B' for BOOLS in method signatures but 'c' in NSValue; that case should match.
if(strcmp(returnType, valueType) != 0 && !(strcmp(returnType, "B") == 0 && strcmp(valueType, "c") == 0))
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Return value does not match method signature." userInfo:nil]; @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"Return value does not match method signature." userInfo:nil];
void *buffer = malloc([[anInvocation methodSignature] methodReturnLength]); void *buffer = malloc([[anInvocation methodSignature] methodReturnLength]);
[returnValue getValue:buffer]; [returnValue getValue:buffer];
......
...@@ -26,3 +26,8 @@ Chromium alters all NSLogging of -[NSArray count] to compile under both 32 and ...@@ -26,3 +26,8 @@ Chromium alters all NSLogging of -[NSArray count] to compile under both 32 and
Chromium also patches in e8a9cc97936bfa8be97706c5092110603745e708 for fixing Chromium also patches in e8a9cc97936bfa8be97706c5092110603745e708 for fixing
unit tests broken with Xcode 5 due to the lack of copyWithZone: selector. unit tests broken with Xcode 5 due to the lack of copyWithZone: selector.
Chromium also patches in 77400c22b5bafd8aaaa75f90a1d997838204577a that fixes
the comparison of types between invocation return type description (which
changed from "c" to "B" on arm64) and NSValue objCType (which didn't change)
on arm64 for BOOL values.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment