llvm/clang/test/ARCMT/objcmt-numeric-literals.m.result

// RUN: rm -rf %t
// RUN: %clang_cc1 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c++ 
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c++ %s.result

#define YES __objc_yes
#define NO __objc_no

typedef long NSInteger;
typedef unsigned long NSUInteger;
typedef signed char BOOL;
#define nil ((void*) 0)

@interface NSObject
+ (id)alloc;
@end

@interface NSNumber : NSObject
@end

@interface NSNumber (NSNumberCreation)
- (id)initWithChar:(char)value;
- (id)initWithUnsignedChar:(unsigned char)value;
- (id)initWithShort:(short)value;
- (id)initWithUnsignedShort:(unsigned short)value;
- (id)initWithInt:(int)value;
- (id)initWithUnsignedInt:(unsigned int)value;
- (id)initWithLong:(long)value;
- (id)initWithUnsignedLong:(unsigned long)value;
- (id)initWithLongLong:(long long)value;
- (id)initWithUnsignedLongLong:(unsigned long long)value;
- (id)initWithFloat:(float)value;
- (id)initWithDouble:(double)value;
- (id)initWithBool:(BOOL)value;
- (id)initWithInteger:(NSInteger)value;
- (id)initWithUnsignedInteger:(NSUInteger)value;

+ (NSNumber *)numberWithChar:(char)value;
+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
+ (NSNumber *)numberWithShort:(short)value;
+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
+ (NSNumber *)numberWithInt:(int)value;
+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
+ (NSNumber *)numberWithLong:(long)value;
+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
+ (NSNumber *)numberWithLongLong:(long long)value;
+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
+ (NSNumber *)numberWithFloat:(float)value;
+ (NSNumber *)numberWithDouble:(double)value;
+ (NSNumber *)numberWithBool:(BOOL)value;
+ (NSNumber *)numberWithInteger:(NSInteger)value;
+ (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value;
@end

#define VAL_INT 2
#define VAL_UINT 2U
#define VAL_CHAR 'a'

void foo() {
  @'a';
  [NSNumber numberWithChar:L'a'];
  [NSNumber numberWithChar:2];
  [NSNumber numberWithChar:2U];
  [NSNumber numberWithChar:2u];
  [NSNumber numberWithChar:2L];
  [NSNumber numberWithChar:2l];
  [NSNumber numberWithChar:2LL];
  [NSNumber numberWithChar:2ll];
  [NSNumber numberWithChar:2ul];
  [NSNumber numberWithChar:2lu];
  [NSNumber numberWithChar:2ull];
  [NSNumber numberWithChar:2llu];
  [NSNumber numberWithChar:2.0];
  [NSNumber numberWithChar:2.0f];
  [NSNumber numberWithChar:2.0F];
  [NSNumber numberWithChar:2.0l];
  [NSNumber numberWithChar:2.0L];
  [NSNumber numberWithChar:0x2f];
  [NSNumber numberWithChar:04];
  [NSNumber numberWithChar:0];
  [NSNumber numberWithChar:0.0];
  [NSNumber numberWithChar:YES];
  [NSNumber numberWithChar:NO];
  [NSNumber numberWithChar:true];
  [NSNumber numberWithChar:false];
  [NSNumber numberWithChar:VAL_INT];
  [NSNumber numberWithChar:VAL_UINT];
  @VAL_CHAR;

  [NSNumber numberWithUnsignedChar:'a'];
  [NSNumber numberWithUnsignedChar:L'a'];
  [NSNumber numberWithUnsignedChar:2];
  [NSNumber numberWithUnsignedChar:2U];
  [NSNumber numberWithUnsignedChar:2u];
  [NSNumber numberWithUnsignedChar:2L];
  [NSNumber numberWithUnsignedChar:2l];
  [NSNumber numberWithUnsignedChar:2LL];
  [NSNumber numberWithUnsignedChar:2ll];
  [NSNumber numberWithUnsignedChar:2ul];
  [NSNumber numberWithUnsignedChar:2lu];
  [NSNumber numberWithUnsignedChar:2ull];
  [NSNumber numberWithUnsignedChar:2llu];
  [NSNumber numberWithUnsignedChar:2.0];
  [NSNumber numberWithUnsignedChar:2.0f];
  [NSNumber numberWithUnsignedChar:2.0F];
  [NSNumber numberWithUnsignedChar:2.0l];
  [NSNumber numberWithUnsignedChar:2.0L];
  [NSNumber numberWithUnsignedChar:0x2f];
  [NSNumber numberWithUnsignedChar:04];
  [NSNumber numberWithUnsignedChar:0];
  [NSNumber numberWithUnsignedChar:0.0];
  [NSNumber numberWithUnsignedChar:YES];
  [NSNumber numberWithUnsignedChar:NO];
  [NSNumber numberWithUnsignedChar:true];
  [NSNumber numberWithUnsignedChar:false];
  [NSNumber numberWithUnsignedChar:VAL_INT];
  [NSNumber numberWithUnsignedChar:VAL_UINT];
  [NSNumber numberWithUnsignedChar:VAL_CHAR];

  [NSNumber numberWithShort:'a'];
  [NSNumber numberWithShort:L'a'];
  [NSNumber numberWithShort:2];
  [NSNumber numberWithShort:2U];
  [NSNumber numberWithShort:2u];
  [NSNumber numberWithShort:2L];
  [NSNumber numberWithShort:2l];
  [NSNumber numberWithShort:2LL];
  [NSNumber numberWithShort:2ll];
  [NSNumber numberWithShort:2ul];
  [NSNumber numberWithShort:2lu];
  [NSNumber numberWithShort:2ull];
  [NSNumber numberWithShort:2llu];
  [NSNumber numberWithShort:2.0];
  [NSNumber numberWithShort:2.0f];
  [NSNumber numberWithShort:2.0F];
  [NSNumber numberWithShort:2.0l];
  [NSNumber numberWithShort:2.0L];
  [NSNumber numberWithShort:0x2f];
  [NSNumber numberWithShort:04];
  [NSNumber numberWithShort:0];
  [NSNumber numberWithShort:0.0];
  [NSNumber numberWithShort:YES];
  [NSNumber numberWithShort:NO];
  [NSNumber numberWithShort:true];
  [NSNumber numberWithShort:false];
  [NSNumber numberWithShort:VAL_INT];
  [NSNumber numberWithShort:VAL_UINT];

  [NSNumber numberWithUnsignedShort:'a'];
  [NSNumber numberWithUnsignedShort:L'a'];
  [NSNumber numberWithUnsignedShort:2];
  [NSNumber numberWithUnsignedShort:2U];
  [NSNumber numberWithUnsignedShort:2u];
  [NSNumber numberWithUnsignedShort:2L];
  [NSNumber numberWithUnsignedShort:2l];
  [NSNumber numberWithUnsignedShort:2LL];
  [NSNumber numberWithUnsignedShort:2ll];
  [NSNumber numberWithUnsignedShort:2ul];
  [NSNumber numberWithUnsignedShort:2lu];
  [NSNumber numberWithUnsignedShort:2ull];
  [NSNumber numberWithUnsignedShort:2llu];
  [NSNumber numberWithUnsignedShort:2.0];
  [NSNumber numberWithUnsignedShort:2.0f];
  [NSNumber numberWithUnsignedShort:2.0F];
  [NSNumber numberWithUnsignedShort:2.0l];
  [NSNumber numberWithUnsignedShort:2.0L];
  [NSNumber numberWithUnsignedShort:0x2f];
  [NSNumber numberWithUnsignedShort:04];
  [NSNumber numberWithUnsignedShort:0];
  [NSNumber numberWithUnsignedShort:0.0];
  [NSNumber numberWithUnsignedShort:YES];
  [NSNumber numberWithUnsignedShort:NO];
  [NSNumber numberWithUnsignedShort:true];
  [NSNumber numberWithUnsignedShort:false];
  [NSNumber numberWithUnsignedShort:VAL_INT];
  [NSNumber numberWithUnsignedShort:VAL_UINT];

  [NSNumber numberWithInt:'a'];
  [NSNumber numberWithInt:L'a'];
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  [NSNumber numberWithInt:2.0];
  [NSNumber numberWithInt:2.0f];
  [NSNumber numberWithInt:2.0F];
  [NSNumber numberWithInt:2.0l];
  [NSNumber numberWithInt:2.0L];
  @0x2f;
  @04;
  @0;
  [NSNumber numberWithInt:0.0];
  [NSNumber numberWithInt:YES];
  [NSNumber numberWithInt:NO];
  [NSNumber numberWithInt:true];
  [NSNumber numberWithInt:false];
  @VAL_INT;
  [NSNumber numberWithInt:VAL_UINT];

  (void)[[NSNumber alloc] initWithInt:2];
  (void)[[NSNumber alloc] initWithInt:2U];

  @+2;
  @-2;

  [NSNumber numberWithUnsignedInt:'a'];
  [NSNumber numberWithUnsignedInt:L'a'];
  @2U;
  @2U;
  @2u;
  @2U;
  @2u;
  @2U;
  @2u;
  @2u;
  @2u;
  @2u;
  @2u;
  [NSNumber numberWithUnsignedInt:2.0];
  [NSNumber numberWithUnsignedInt:2.0f];
  [NSNumber numberWithUnsignedInt:2.0F];
  [NSNumber numberWithUnsignedInt:2.0l];
  [NSNumber numberWithUnsignedInt:2.0L];
  @0x2fU;
  @04U;
  @0U;
  [NSNumber numberWithUnsignedInt:0.0];
  [NSNumber numberWithUnsignedInt:YES];
  [NSNumber numberWithUnsignedInt:NO];
  [NSNumber numberWithUnsignedInt:true];
  [NSNumber numberWithUnsignedInt:false];
  [NSNumber numberWithUnsignedInt:VAL_INT];
  @VAL_UINT;

  [NSNumber numberWithLong:'a'];
  [NSNumber numberWithLong:L'a'];
  @2L;
  @2L;
  @2l;
  @2L;
  @2l;
  @2L;
  @2l;
  @2l;
  @2l;
  @2l;
  @2l;
  [NSNumber numberWithLong:2.0];
  [NSNumber numberWithLong:2.0f];
  [NSNumber numberWithLong:2.0F];
  [NSNumber numberWithLong:2.0l];
  [NSNumber numberWithLong:2.0L];
  @0x2fL;
  @04L;
  @0L;
  [NSNumber numberWithLong:0.0];
  [NSNumber numberWithLong:YES];
  [NSNumber numberWithLong:NO];
  [NSNumber numberWithLong:true];
  [NSNumber numberWithLong:false];
  [NSNumber numberWithLong:VAL_INT];
  [NSNumber numberWithLong:VAL_UINT];

  [NSNumber numberWithUnsignedLong:'a'];
  [NSNumber numberWithUnsignedLong:L'a'];
  @2UL;
  @2UL;
  @2ul;
  @2UL;
  @2ul;
  @2UL;
  @2ul;
  @2ul;
  @2lu;
  @2ul;
  @2ul;
  [NSNumber numberWithUnsignedLong:2.0];
  [NSNumber numberWithUnsignedLong:2.0f];
  [NSNumber numberWithUnsignedLong:2.0F];
  [NSNumber numberWithUnsignedLong:2.0l];
  [NSNumber numberWithUnsignedLong:2.0L];
  @0x2fUL;
  @04UL;
  @0UL;
  [NSNumber numberWithUnsignedLong:0.0];
  [NSNumber numberWithUnsignedLong:YES];
  [NSNumber numberWithUnsignedLong:NO];
  [NSNumber numberWithUnsignedLong:true];
  [NSNumber numberWithUnsignedLong:false];
  [NSNumber numberWithUnsignedLong:VAL_INT];
  [NSNumber numberWithUnsignedLong:VAL_UINT];

  [NSNumber numberWithLongLong:'a'];
  [NSNumber numberWithLongLong:L'a'];
  @2LL;
  @2LL;
  @2ll;
  @2LL;
  @2ll;
  @2LL;
  @2ll;
  @2ll;
  @2ll;
  @2ll;
  @2ll;
  [NSNumber numberWithLongLong:2.0];
  [NSNumber numberWithLongLong:2.0f];
  [NSNumber numberWithLongLong:2.0F];
  [NSNumber numberWithLongLong:2.0l];
  [NSNumber numberWithLongLong:2.0L];
  @0x2fLL;
  @04LL;
  @0LL;
  [NSNumber numberWithLongLong:0.0];
  [NSNumber numberWithLongLong:YES];
  [NSNumber numberWithLongLong:NO];
  [NSNumber numberWithLongLong:true];
  [NSNumber numberWithLongLong:false];
  [NSNumber numberWithLongLong:VAL_INT];
  [NSNumber numberWithLongLong:VAL_UINT];

  [NSNumber numberWithUnsignedLongLong:'a'];
  [NSNumber numberWithUnsignedLongLong:L'a'];
  @2ULL;
  @2ULL;
  @2ull;
  @2ULL;
  @2ull;
  @2ULL;
  @2ull;
  @2ull;
  @2ull;
  @2ull;
  @2llu;
  [NSNumber numberWithUnsignedLongLong:2.0];
  [NSNumber numberWithUnsignedLongLong:2.0f];
  [NSNumber numberWithUnsignedLongLong:2.0F];
  [NSNumber numberWithUnsignedLongLong:2.0l];
  [NSNumber numberWithUnsignedLongLong:2.0L];
  @0x2fULL;
  @04ULL;
  @0ULL;
  [NSNumber numberWithUnsignedLongLong:0.0];
  [NSNumber numberWithUnsignedLongLong:YES];
  [NSNumber numberWithUnsignedLongLong:NO];
  [NSNumber numberWithUnsignedLongLong:true];
  [NSNumber numberWithUnsignedLongLong:false];
  [NSNumber numberWithUnsignedLongLong:VAL_INT];
  [NSNumber numberWithUnsignedLongLong:VAL_UINT];

  [NSNumber numberWithFloat:'a'];
  [NSNumber numberWithFloat:L'a'];
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0f;
  @2.0F;
  @2.0f;
  @2.0f;
  [NSNumber numberWithFloat:0x2f];
  [NSNumber numberWithFloat:04];
  @0.0f;
  @0.0f;
  [NSNumber numberWithFloat:YES];
  [NSNumber numberWithFloat:NO];
  [NSNumber numberWithFloat:true];
  [NSNumber numberWithFloat:false];
  [NSNumber numberWithFloat:VAL_INT];
  [NSNumber numberWithFloat:VAL_UINT];

  [NSNumber numberWithDouble:'a'];
  [NSNumber numberWithDouble:L'a'];
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  @2.0;
  [NSNumber numberWithDouble:0x2f];
  [NSNumber numberWithDouble:04];
  @0.0;
  @0.0;
  [NSNumber numberWithDouble:YES];
  [NSNumber numberWithDouble:NO];
  [NSNumber numberWithDouble:true];
  [NSNumber numberWithDouble:false];
  [NSNumber numberWithDouble:VAL_INT];
  [NSNumber numberWithDouble:VAL_UINT];

  [NSNumber numberWithBool:'a'];
  [NSNumber numberWithBool:L'a'];
  [NSNumber numberWithBool:2];
  [NSNumber numberWithBool:2U];
  [NSNumber numberWithBool:2u];
  [NSNumber numberWithBool:2L];
  [NSNumber numberWithBool:2l];
  [NSNumber numberWithBool:2LL];
  [NSNumber numberWithBool:2ll];
  [NSNumber numberWithBool:2ul];
  [NSNumber numberWithBool:2lu];
  [NSNumber numberWithBool:2ull];
  [NSNumber numberWithBool:2llu];
  [NSNumber numberWithBool:2.0];
  [NSNumber numberWithBool:2.0f];
  [NSNumber numberWithBool:2.0F];
  [NSNumber numberWithBool:2.0l];
  [NSNumber numberWithBool:2.0L];
  [NSNumber numberWithBool:0x2f];
  [NSNumber numberWithBool:04];
  [NSNumber numberWithBool:0];
  [NSNumber numberWithBool:0.0];
  @YES;
  @NO;
  @true;
  @false;
  [NSNumber numberWithBool:VAL_INT];
  [NSNumber numberWithBool:VAL_UINT];

  [NSNumber numberWithInteger:'a'];
  [NSNumber numberWithInteger:L'a'];
  @2;
  @2;
  @2;
  @2L;
  @2l;
  @2;
  @2;
  @2;
  @2;
  @2;
  @2;
  [NSNumber numberWithInteger:2.0];
  [NSNumber numberWithInteger:2.0f];
  [NSNumber numberWithInteger:2.0F];
  [NSNumber numberWithInteger:2.0l];
  [NSNumber numberWithInteger:2.0L];
  @0x2f;
  @04;
  @0;
  [NSNumber numberWithInteger:0.0];
  [NSNumber numberWithInteger:YES];
  [NSNumber numberWithInteger:NO];
  [NSNumber numberWithInteger:true];
  [NSNumber numberWithInteger:false];
  @VAL_INT;
  [NSNumber numberWithInteger:VAL_UINT];

  [NSNumber numberWithUnsignedInteger:'a'];
  [NSNumber numberWithUnsignedInteger:L'a'];
  @2U;
  @2U;
  @2u;
  @2U;
  @2u;
  @2U;
  @2u;
  @2ul;
  @2lu;
  @2u;
  @2u;
  [NSNumber numberWithUnsignedInteger:2.0];
  [NSNumber numberWithUnsignedInteger:2.0f];
  [NSNumber numberWithUnsignedInteger:2.0F];
  [NSNumber numberWithUnsignedInteger:2.0l];
  [NSNumber numberWithUnsignedInteger:2.0L];
  @0x2fU;
  @04U;
  @0U;
  [NSNumber numberWithUnsignedInteger:0.0];
  [NSNumber numberWithUnsignedInteger:YES];
  [NSNumber numberWithUnsignedInteger:NO];
  [NSNumber numberWithUnsignedInteger:true];
  [NSNumber numberWithUnsignedInteger:false];
  [NSNumber numberWithUnsignedInteger:VAL_INT];
  @VAL_UINT;
}