1 | // RUN: rm -rf %t |
2 | // RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11 |
3 | // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result |
4 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result |
5 | // rdar://15396636 |
6 | |
7 | #ifndef NS_RETURNS_INNER_POINTER // defined in iOS 6 for sure |
8 | #define NS_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer)) |
9 | #endif |
10 | |
11 | #define CF_IMPLICIT_BRIDGING_ENABLED _Pragma("clang arc_cf_code_audited begin") |
12 | |
13 | #define CF_IMPLICIT_BRIDGING_DISABLED _Pragma("clang arc_cf_code_audited end") |
14 | |
15 | #if __has_feature(attribute_ns_returns_retained) |
16 | #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) |
17 | #endif |
18 | #if __has_feature(attribute_cf_returns_retained) |
19 | #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) |
20 | #endif |
21 | #if __has_feature(attribute_ns_returns_not_retained) |
22 | #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) |
23 | #endif |
24 | #if __has_feature(attribute_cf_returns_not_retained) |
25 | #define CF_RETURNS_NOT_RETAINED __attribute__((cf_returns_not_retained)) |
26 | #endif |
27 | #if __has_feature(attribute_ns_consumes_self) |
28 | #define NS_CONSUMES_SELF __attribute__((ns_consumes_self)) |
29 | #endif |
30 | #if __has_feature(attribute_ns_consumed) |
31 | #define NS_CONSUMED __attribute__((ns_consumed)) |
32 | #endif |
33 | #if __has_feature(attribute_cf_consumed) |
34 | #define CF_CONSUMED __attribute__((cf_consumed)) |
35 | #endif |
36 | #if __has_attribute(ns_returns_autoreleased) |
37 | #define NS_RETURNS_AUTORELEASED __attribute__((ns_returns_autoreleased)) |
38 | #endif |
39 | |
40 | #define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0))) |
41 | |
42 | CF_IMPLICIT_BRIDGING_ENABLED |
43 | |
44 | typedef unsigned long CFTypeID; |
45 | typedef unsigned long CFOptionFlags; |
46 | typedef unsigned long CFHashCode; |
47 | |
48 | typedef signed long CFIndex; /*AnyObj*/ |
49 | typedef const struct __CFArray * CFArrayRef; |
50 | typedef struct { |
51 | CFIndex location; |
52 | CFIndex length; |
53 | } CFRange; |
54 | |
55 | typedef void (*CFArrayApplierFunction)(const void *value, void *context); |
56 | |
57 | typedef enum CFComparisonResult : CFIndex CFComparisonResult; enum CFComparisonResult : CFIndex { |
58 | kCFCompareLessThan = -1L, |
59 | kCFCompareEqualTo = 0, |
60 | kCFCompareGreaterThan = 1 |
61 | }; |
62 | |
63 | |
64 | typedef CFComparisonResult (*CFComparatorFunction)(const void *val1, const void *val2, void *context); |
65 | |
66 | typedef struct __CFArray * CFMutableArrayRef; |
67 | |
68 | typedef const struct __CFAttributedString *CFAttributedStringRef; |
69 | typedef struct __CFAttributedString *CFMutableAttributedStringRef; |
70 | |
71 | typedef const struct __CFAllocator * CFAllocatorRef; |
72 | |
73 | typedef const struct __CFString * CFStringRef; |
74 | typedef struct __CFString * CFMutableStringRef; |
75 | |
76 | typedef const struct __CFDictionary * CFDictionaryRef; |
77 | typedef struct __CFDictionary * CFMutableDictionaryRef; |
78 | |
79 | typedef struct CGImage *CGImageRef; |
80 | |
81 | typedef struct OpaqueJSValue* JSObjectRef; |
82 | |
83 | typedef JSObjectRef TTJSObjectRef; |
84 | typedef unsigned int NSUInteger; |
85 | |
86 | CF_IMPLICIT_BRIDGING_DISABLED |
87 | |
88 | @interface I |
89 | - (void*) ReturnsInnerPointer; |
90 | - (int*) AlreadyReturnsInnerPointer NS_RETURNS_INNER_POINTER; |
91 | @end |
92 | |
93 | @interface UIImage |
94 | - (CGImageRef)CGImage; |
95 | @end |
96 | |
97 | @interface NSData |
98 | - (void *)bytes; |
99 | - (void **) ptr_bytes __attribute__((availability(macosx,unavailable))); |
100 | @end |
101 | |
102 | @interface NSMutableData |
103 | - (void *)mutableBytes __attribute__((deprecated)) __attribute__((unavailable)); |
104 | @end |
105 | |
106 | @interface JS |
107 | - (JSObjectRef)JSObject; |
108 | - (TTJSObjectRef)JSObject1; |
109 | - (JSObjectRef*)JSObject2; |
110 | @end |
111 | |
112 | // rdar://15044991 |
113 | typedef void *SecTrustRef; |
114 | |
115 | @interface NSURLProtectionSpace |
116 | @property (readonly) SecTrustRef serverTrust NS_AVAILABLE; |
117 | - (void *) FOO NS_AVAILABLE; |
118 | @property (readonly) void * mitTrust NS_AVAILABLE; |
119 | |
120 | @property (readonly) void * mittiTrust; |
121 | |
122 | @property (readonly) SecTrustRef XserverTrust; |
123 | |
124 | - (SecTrustRef) FOO1 NS_AVAILABLE; |
125 | |
126 | + (const NSURLProtectionSpace *)ProtectionSpace; |
127 | |
128 | // pointer personality functions |
129 | @property NSUInteger (*hashFunction)(const void *item, NSUInteger (*size)(const void *item)); |
130 | @end |
131 | |
132 | @interface MustNotMigrateToInnerPointer |
133 | - (void*) nono; |
134 | - (void) setNono : (void*) val; |
135 | @end |
136 | |