| 1 | // RUN: rm -rf %t |
| 2 | // RUN: %clang_cc1 -objcmt-migrate-instancetype -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-darwin11 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result |
| 5 | |
| 6 | typedef unsigned int NSUInteger; |
| 7 | typedef int NSInteger; |
| 8 | typedef char BOOL; |
| 9 | @class NSData, NSError, NSProtocolChecker, NSObject; |
| 10 | @class NSPortNameServer, NSTimeZone; |
| 11 | |
| 12 | @interface NSMutableString |
| 13 | @end |
| 14 | |
| 15 | @interface NSString @end |
| 16 | |
| 17 | @class NSString, NSURL; |
| 18 | @interface NSString (NSStringDeprecated) |
| 19 | + (id)stringWithContentsOfFile:(NSString *)path __attribute__((availability(macosx,introduced=10.0 ,message="" ))); |
| 20 | + (id)stringWithContentsOfURL:(NSURL *)url __attribute__((availability(macosx,introduced=10.0 ,message="" ))); |
| 21 | + (id)stringWithCString:(const char *)bytes length:(NSUInteger)length __attribute__((availability(macosx,introduced=10.0 ,message="" ))); |
| 22 | + (id)stringWithCString:(const char *)bytes __attribute__((availability(macosx,introduced=10.0 ,message="" ))); |
| 23 | @end |
| 24 | |
| 25 | |
| 26 | typedef enum NSURLBookmarkResolutionOptions { |
| 27 | Bookmark |
| 28 | } NSURLBookmarkResolutionOptions; |
| 29 | |
| 30 | @interface NSURL |
| 31 | + (instancetype)URLWithString:(NSString *)URLString; |
| 32 | + (instancetype)URLWithString:(NSString *)URLString relativeToURL:(NSURL *)baseURL; |
| 33 | + (instancetype)URLByResolvingBookmarkData:(NSData *)bookmarkData options:(NSURLBookmarkResolutionOptions)options relativeToURL:(NSURL *)relativeURL bookmarkDataIsStale:(BOOL *)isStale error:(NSError **)error __attribute__((availability(macosx,introduced=10.6))); |
| 34 | @end |
| 35 | |
| 36 | @class NSDictionary; |
| 37 | @interface NSError |
| 38 | + (instancetype)errorWithDomain:(NSString *)domain code:(NSInteger)code userInfo:(NSDictionary *)dict; |
| 39 | @end |
| 40 | |
| 41 | |
| 42 | @interface NSMutableString (NSMutableStringExtensionMethods) |
| 43 | + (instancetype)stringWithCapacity:(NSUInteger)capacity; |
| 44 | @end |
| 45 | |
| 46 | @interface NSMutableData |
| 47 | + (instancetype)dataWithCapacity:(NSUInteger)aNumItems; |
| 48 | + (instancetype)dataWithLength:(NSUInteger)length; |
| 49 | @end |
| 50 | |
| 51 | @interface NSMutableDictionary @end |
| 52 | |
| 53 | @interface NSMutableDictionary (NSSharedKeySetDictionary) |
| 54 | + (instancetype )dictionaryWithSharedKeySet:(id)keyset __attribute__((availability(macosx,introduced=10.8))); |
| 55 | @end |
| 56 | |
| 57 | @interface NSProtocolChecker |
| 58 | + (instancetype)protocolCheckerWithTarget:(NSObject *)anObject protocol:(Protocol *)aProtocol; |
| 59 | @end |
| 60 | |
| 61 | @interface NSConnection |
| 62 | + (instancetype)connectionWithRegisteredName:(NSString *)name host:(NSString *)hostName; |
| 63 | + (instancetype)connectionWithRegisteredName:(NSString *)name host:(NSString *)hostName usingNameServer:(NSPortNameServer *)server; |
| 64 | @end |
| 65 | |
| 66 | @interface NSDate |
| 67 | + (instancetype)dateWithString:(NSString *)aString __attribute__((availability(macosx,introduced=10.4))); |
| 68 | @end |
| 69 | |
| 70 | @interface NSCalendarDate : NSDate |
| 71 | + (instancetype)calendarDate __attribute__((availability(macosx,introduced=10.4))); |
| 72 | + (instancetype)dateWithString:(NSString *)description calendarFormat:(NSString *)format locale:(id)locale __attribute__((availability(macosx,introduced=10.4))); |
| 73 | + (instancetype)dateWithString:(NSString *)description calendarFormat:(NSString *)format __attribute__((availability(macosx,introduced=10.4))); |
| 74 | + (instancetype)dateWithYear:(NSInteger)year month:(NSUInteger)month day:(NSUInteger)day hour:(NSUInteger)hour minute:(NSUInteger)minute second:(NSUInteger)second timeZone:(NSTimeZone *)aTimeZone __attribute__((availability(macosx,introduced=10.4))); |
| 75 | @end |
| 76 | |
| 77 | @interface NSUserDefaults |
| 78 | + (instancetype) standardUserDefaults; |
| 79 | @end |
| 80 | |
| 81 | @interface NSNotificationCenter |
| 82 | + (NSNotificationCenter*) defaultCenter; |
| 83 | + (NSNotificationCenter*) sharedCenter; |
| 84 | @end |
| 85 | |
| 86 | @interface UIApplication |
| 87 | + (UIApplication*)sharedApplication; |
| 88 | + (UIApplication*) defaultApplication; |
| 89 | @end |
| 90 | |
| 91 | //===----------------------------------------------------------------------===// |
| 92 | // Method name that has a null IdentifierInfo* for its first selector slot. |
| 93 | // This test just makes sure that we handle it. |
| 94 | //===----------------------------------------------------------------------===// |
| 95 | @interface TestNullIdentifier |
| 96 | @end |
| 97 | |
| 98 | @implementation TestNullIdentifier |
| 99 | + (id):(int)x, ... { |
| 100 | return 0; |
| 101 | } |
| 102 | @end |
| 103 | |
| 104 | |