| 1 | #import <Foundation/Foundation.h> |
| 2 | #include <TargetConditionals.h> |
| 3 | |
| 4 | #if TARGET_OS_IPHONE |
| 5 | @import CoreGraphics; |
| 6 | typedef CGRect NSRect; |
| 7 | #endif |
| 8 | |
| 9 | struct 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 | @end |
| 19 | |
| 20 | @implementation ThingSummer |
| 21 | -(int)sumThings:(struct things_to_sum)tts |
| 22 | { |
| 23 | return tts.a + tts.b + tts.c; |
| 24 | } |
| 25 | @end |
| 26 | |
| 27 | int main() |
| 28 | { |
| 29 | @autoreleasepool |
| 30 | { |
| 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 need |
| 36 | // 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 | |