1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -emit-pch -o %t %s 2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -include-pch %t -verify %s 3*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -include-pch %t -ast-print %s | FileCheck -check-prefix=CHECK-PRINT %s 4*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -include-pch %t -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-IR %s 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc// expected-no-diagnostics 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc#ifndef HEADER 9*f4a2713aSLionel Sambuc#define HEADER 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuctypedef unsigned char BOOL; 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc@interface NSNumber @end 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc@interface NSNumber (NSNumberCreation) 16*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithChar:(char)value; 17*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value; 18*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithShort:(short)value; 19*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value; 20*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithInt:(int)value; 21*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value; 22*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithLong:(long)value; 23*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value; 24*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithLongLong:(long long)value; 25*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value; 26*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithFloat:(float)value; 27*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithDouble:(double)value; 28*f4a2713aSLionel Sambuc+ (NSNumber *)numberWithBool:(BOOL)value; 29*f4a2713aSLionel Sambuc@end 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc@interface NSArray 32*f4a2713aSLionel Sambuc@end 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuc@interface NSArray (NSArrayCreation) 35*f4a2713aSLionel Sambuc+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; 36*f4a2713aSLionel Sambuc@end 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc@interface NSDictionary 39*f4a2713aSLionel Sambuc+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; 40*f4a2713aSLionel Sambuc@end 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc// CHECK-IR: define internal void @test_numeric_literals() 43*f4a2713aSLionel Sambucstatic inline void test_numeric_literals() { 44*f4a2713aSLionel Sambuc // CHECK-PRINT: id intlit = @17 45*f4a2713aSLionel Sambuc // CHECK-IR: {{call.*17}} 46*f4a2713aSLionel Sambuc id intlit = @17; 47*f4a2713aSLionel Sambuc // CHECK-PRINT: id floatlit = @17.449999999999999 48*f4a2713aSLionel Sambuc // CHECK-IR: {{call.*1.745}} 49*f4a2713aSLionel Sambuc id floatlit = @17.45; 50*f4a2713aSLionel Sambuc} 51*f4a2713aSLionel Sambuc 52*f4a2713aSLionel Sambucstatic inline void test_array_literals() { 53*f4a2713aSLionel Sambuc // CHECK-PRINT: id arraylit = @[ @17, @17.449999999999999 54*f4a2713aSLionel Sambuc id arraylit = @[@17, @17.45]; 55*f4a2713aSLionel Sambuc} 56*f4a2713aSLionel Sambuc 57*f4a2713aSLionel Sambucstatic inline void test_dictionary_literals() { 58*f4a2713aSLionel Sambuc // CHECK-PRINT: id dictlit = @{ @17 : {{@17.449999999999999[^,]*}}, @"hello" : @"world" }; 59*f4a2713aSLionel Sambuc id dictlit = @{@17 : @17.45, @"hello" : @"world" }; 60*f4a2713aSLionel Sambuc} 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc#else 63*f4a2713aSLionel Sambucvoid test_all() { 64*f4a2713aSLionel Sambuc test_numeric_literals(); 65*f4a2713aSLionel Sambuc test_array_literals(); 66*f4a2713aSLionel Sambuc test_dictionary_literals(); 67*f4a2713aSLionel Sambuc} 68*f4a2713aSLionel Sambuc#endif 69