1 // RUN: %clang_cc1 -x objective-c -triple x86_64-apple-darwin10 -fblocks -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fblocks -emit-llvm %s -o - | FileCheck %s
4 #if __has_feature(objc_bool)
12 #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
13 typedef unsigned long NSUInteger;
14 typedef long NSInteger;
16 typedef unsigned int NSUInteger;
17 typedef int NSInteger;
19 typedef signed char BOOL;
21 @interface NSNumber @end
23 @interface NSNumber (NSNumberCreation)
24 #if __has_feature(objc_array_literals)
25 + (NSNumber *)numberWithChar:(char)value;
26 + (NSNumber *)numberWithUnsignedChar:(unsigned char)value;
27 + (NSNumber *)numberWithShort:(short)value;
28 + (NSNumber *)numberWithUnsignedShort:(unsigned short)value;
29 + (NSNumber *)numberWithInt:(int)value;
30 + (NSNumber *)numberWithUnsignedInt:(unsigned int)value;
31 + (NSNumber *)numberWithLong:(long)value;
32 + (NSNumber *)numberWithUnsignedLong:(unsigned long)value;
33 + (NSNumber *)numberWithLongLong:(long long)value;
34 + (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value;
35 + (NSNumber *)numberWithFloat:(float)value;
36 + (NSNumber *)numberWithDouble:(double)value;
37 + (NSNumber *)numberWithBool:(BOOL)value;
38 + (NSNumber *)numberWithInteger:(NSInteger)value ;
39 + (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value ;
47 #if __has_feature(objc_dictionary_literals)
48 @interface NSDictionary
49 + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt;
55 // CHECK: define{{.*}} i32 @main() [[NUW:#[0-9]+]]
57 // CHECK: call{{.*}}@objc_msgSend{{.*}}i8 noundef signext 97
58 NSNumber *aNumber = @'a';
59 // CHECK: call{{.*}}@objc_msgSend{{.*}}i32 noundef 42
60 NSNumber *fortyTwo = @42;
61 // CHECK: call{{.*}}@objc_msgSend{{.*}}i32 noundef -42
62 NSNumber *negativeFortyTwo = @-42;
63 // CHECK: call{{.*}}@objc_msgSend{{.*}}i32 noundef 42
64 NSNumber *positiveFortyTwo = @+42;
65 // CHECK: call{{.*}}@objc_msgSend{{.*}}i32 noundef 42
66 NSNumber *fortyTwoUnsigned = @42u;
67 // CHECK: call{{.*}}@objc_msgSend{{.*}}i64 noundef 42
68 NSNumber *fortyTwoLong = @42l;
69 // CHECK: call{{.*}}@objc_msgSend{{.*}}i64 noundef 42
70 NSNumber *fortyTwoLongLong = @42ll;
71 // CHECK: call{{.*}}@objc_msgSend{{.*}}float noundef 0x400921FB60000000
72 NSNumber *piFloat = @3.141592654f;
73 // CHECK: call{{.*}}@objc_msgSend{{.*}}double noundef 0x400921FB54411744
74 NSNumber *piDouble = @3.1415926535;
75 // CHECK: call{{.*}}@objc_msgSend{{.*}}i8 noundef signext 1
76 NSNumber *yesNumber = @__objc_yes;
77 // CHECK: call{{.*}}@objc_msgSend{{.*}}i8 noundef signext 0
78 NSNumber *noNumber = @__objc_no;
79 // CHECK: call{{.*}}@objc_msgSend{{.*}}i8 noundef signext 1
80 NSNumber *yesNumber1 = @YES;
81 // CHECK: call{{.*}}@objc_msgSend{{.*}}i8 noundef signext 0
82 NSNumber *noNumber1 = @NO;
83 NSDictionary *dictionary = @{@"name" : NSUserName(),
84 @"date" : [NSDate date] };
85 return __objc_yes == __objc_no;
88 typedef BOOL (^foo)(void);
89 extern void bar(foo a);
92 bar(^(void) { return YES; });
95 // CHECK: attributes [[NUW]] = { {{.*}}noinline {{(norecurse )?}}nounwind{{.*}} }