2 // RUN: %clang_cc1 -fobjc-arc -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++ -verify
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++ %s.result
9 typedef long NSInteger;
10 typedef unsigned long NSUInteger;
11 typedef signed char BOOL;
12 #define nil ((void*) 0)
14 #define INT_MIN (-__INT_MAX__ -1)
20 @interface NSNumber : NSObject
23 @interface NSNumber (NSNumberCreation)
24 - (id)initWithChar:(char)value;
25 - (id)initWithUnsignedChar:(unsigned char)value;
26 - (id)initWithShort:(short)value;
27 - (id)initWithUnsignedShort:(unsigned short)value;
28 - (id)initWithInt:(int)value;
29 - (id)initWithUnsignedInt:(unsigned int)value;
30 - (id)initWithLong:(long)value;
31 - (id)initWithUnsignedLong:(unsigned long)value;
32 - (id)initWithLongLong:(long long)value;
33 - (id)initWithUnsignedLongLong:(unsigned long long)value;
34 - (id)initWithFloat:(float)value;
35 - (id)initWithDouble:(double)value;
36 - (id)initWithBool:(BOOL)value;
37 - (id)initWithInteger:(NSInteger)value;
38 - (id)initWithUnsignedInteger:(NSUInteger)value;
40 + (NSNumber *)numberWithChar:(char)value;
41 + (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
42 + (NSNumber *)numberWithShort:(short)value;
43 + (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
44 + (NSNumber *)numberWithInt:(int)value;
45 + (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
46 + (NSNumber *)numberWithLong:(long)value;
47 + (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
48 + (NSNumber *)numberWithLongLong:(long long)value;
49 + (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
50 + (NSNumber *)numberWithFloat:(float)value;
51 + (NSNumber *)numberWithDouble:(double)value;
52 + (NSNumber *)numberWithBool:(BOOL)value;
53 + (NSNumber *)numberWithInteger:(NSInteger)value;
54 + (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value;
58 NSASCIIStringEncoding = 1,
59 NSUTF8StringEncoding = 4,
60 NSUnicodeStringEncoding = 10
62 typedef NSUInteger NSStringEncoding;
64 @interface NSString : NSObject
67 @interface NSString (NSStringExtensionMethods)
68 + (id)stringWithUTF8String:(const char *)nullTerminatedCString;
69 + (id)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc;
70 + (id)stringWithCString:(const char *)bytes;
71 - (instancetype)initWithUTF8String:(const char *)nullTerminatedCString;
79 [NSNumber numberWithInt:INT_MIN];
81 [NSNumber numberWithBool:cppb];
83 [NSNumber numberWithInteger:myenum];
84 [NSNumber numberWithInteger:ME_foo];
85 [NSNumber numberWithDouble:cppb]; // expected-warning {{converting to boxing syntax requires casting 'bool' to 'double'}}
89 NSString *s = [NSString stringWithUTF8String:"box"];
92 s = [NSString stringWithUTF8String:cstr1];
93 s = [NSString stringWithUTF8String:cstr2];
94 s = [NSString stringWithCString:cstr1 encoding:NSASCIIStringEncoding];
95 s = [NSString stringWithCString:cstr1 encoding:NSUTF8StringEncoding];
96 s = [NSString stringWithCString:cstr1 encoding: NSUnicodeStringEncoding];
97 NSStringEncoding encode;
98 s = [NSString stringWithCString:cstr1 encoding:encode];
99 s = [NSString stringWithCString:cstr1];
101 static const char strarr[] = "coolbox";
102 s = [NSString stringWithUTF8String:strarr];
103 const char *utf8Bytes = "blah";
104 NSString *string1 = [NSString stringWithUTF8String:utf8Bytes];
105 NSString *string2 = [[NSString alloc] initWithUTF8String:utf8Bytes];