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