41 lines · plain
1#import <Foundation/Foundation.h>2#include <TargetConditionals.h>3 4#if TARGET_OS_IPHONE5@import CoreGraphics;6typedef CGRect NSRect;7#endif8 9struct things_to_sum {10 int a;11 int b;12 int c;13};14 15@interface ThingSummer : NSObject {16};17-(int)sumThings:(struct things_to_sum)tts;18@end19 20@implementation ThingSummer21-(int)sumThings:(struct things_to_sum)tts22{23 return tts.a + tts.b + tts.c;24}25@end26 27int main()28{29 @autoreleasepool30 {31 ThingSummer *summer = [ThingSummer alloc];32 struct things_to_sum tts = { 2, 3, 4 };33 int ret = [summer sumThings:tts];34 NSRect rect = {{0, 0}, {10, 20}}; 35 // The Objective-C V1 runtime won't read types from metadata so we need36 // NSValue in our debug info to use it in our test.37 NSValue *v = [NSValue valueWithRect:rect];38 return rect.origin.x; // Set breakpoint here.39 }40}41