2012-05-11 07:12:03 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
@interface NSString : NSObject
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NSString (NSStringExtensionMethods)
|
|
|
|
+ (id)stringWithUTF8String:(const char *)nullTerminatedCString;
|
|
|
|
@end
|
|
|
|
|
2014-11-06 21:30:38 +08:00
|
|
|
// CHECK: [[WithIntMeth:@.*]] = private global [15 x i8] c"numberWithInt:\00"
|
2015-03-14 02:21:46 +08:00
|
|
|
// CHECK: [[WithIntSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[WithIntMeth]]
|
2014-11-06 21:30:38 +08:00
|
|
|
// CHECK: [[WithCharMeth:@.*]] = private global [16 x i8] c"numberWithChar:\00"
|
2015-03-14 02:21:46 +08:00
|
|
|
// CHECK: [[WithCharSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithCharMeth]]
|
2014-11-06 21:30:38 +08:00
|
|
|
// CHECK: [[WithBoolMeth:@.*]] = private global [16 x i8] c"numberWithBool:\00"
|
2015-03-14 02:21:46 +08:00
|
|
|
// CHECK: [[WithBoolSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithBoolMeth]]
|
2014-11-06 21:30:38 +08:00
|
|
|
// CHECK: [[WithIntegerMeth:@.*]] = private global [19 x i8] c"numberWithInteger:\00"
|
2015-03-14 02:21:46 +08:00
|
|
|
// CHECK: [[WithIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[WithIntegerMeth]]
|
2014-11-06 21:30:38 +08:00
|
|
|
// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private global [27 x i8] c"numberWithUnsignedInteger:\00"
|
2015-03-14 02:21:46 +08:00
|
|
|
// CHECK: [[WithUnsignedIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([27 x i8], [27 x i8]* [[WithUnsignedIntegerMeth]]
|
2014-11-06 21:30:38 +08:00
|
|
|
// CHECK: [[stringWithUTF8StringMeth:@.*]] = private global [22 x i8] c"stringWithUTF8String:\00"
|
2015-03-14 02:21:46 +08:00
|
|
|
// CHECK: [[stringWithUTF8StringSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[stringWithUTF8StringMeth]]
|
2012-05-11 07:12:03 +08:00
|
|
|
|
|
|
|
int main() {
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithIntSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
int i; @(i);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithCharSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
signed char sc; @(sc);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithBoolSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
BOOL b; @(b);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithBoolSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
typeof(b) b2; @(b2);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithBoolSEL]]
|
2012-05-11 09:53:27 +08:00
|
|
|
typedef const typeof(b) MyBOOL; MyBOOL b3; @(b3);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithBoolSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
@((BOOL)i);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithIntegerSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
@((NSInteger)i);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithUnsignedIntegerSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
@((NSUInteger)i);
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[stringWithUTF8StringSEL]]
|
2012-05-11 07:12:03 +08:00
|
|
|
const char *s; @(s);
|
2012-05-16 04:45:35 +08:00
|
|
|
|
|
|
|
typedef enum : NSInteger { Red, Green, Blue } Color;
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithIntegerSEL]]
|
2012-05-16 04:45:35 +08:00
|
|
|
@(Red);
|
|
|
|
Color col = Red;
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: load i8*, i8** [[WithIntegerSEL]]
|
2012-05-16 04:45:35 +08:00
|
|
|
@(col);
|
2012-05-11 07:12:03 +08:00
|
|
|
}
|