| 1 |
// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}} |
| 2 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-pch -x objective-c++ -std=c++0x -o %t %s |
| 3 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -include-pch %t -x objective-c++ -std=c++0x -verify %s |
| 4 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -include-pch %t -x objective-c++ -std=c++0x -ast-print %s | FileCheck -check-prefix=CHECK-PRINT %s |
| 5 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -include-pch %t -x objective-c++ -std=c++0x -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-IR %s |
| 6 |
|
| 7 |
// expected-no-diagnostics |
| 8 |
|
| 9 |
#ifndef HEADER |
| 10 |
#define HEADER |
| 11 |
|
| 12 |
typedef unsigned char BOOL; |
| 13 |
|
| 14 |
@interface NSNumber @end |
| 15 |
|
| 16 |
@interface NSNumber (NSNumberCreation) |
| 17 |
+ (NSNumber *)numberWithChar:(char)value; |
| 18 |
+ (NSNumber *)numberWithUnsignedChar:(unsigned char)value; |
| 19 |
+ (NSNumber *)numberWithShort:(short)value; |
| 20 |
+ (NSNumber *)numberWithUnsignedShort:(unsigned short)value; |
| 21 |
+ (NSNumber *)numberWithInt:(int)value; |
| 22 |
+ (NSNumber *)numberWithUnsignedInt:(unsigned int)value; |
| 23 |
+ (NSNumber *)numberWithLong:(long)value; |
| 24 |
+ (NSNumber *)numberWithUnsignedLong:(unsigned long)value; |
| 25 |
+ (NSNumber *)numberWithLongLong:(long long)value; |
| 26 |
+ (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value; |
| 27 |
+ (NSNumber *)numberWithFloat:(float)value; |
| 28 |
+ (NSNumber *)numberWithDouble:(double)value; |
| 29 |
+ (NSNumber *)numberWithBool:(BOOL)value; |
| 30 |
@end |
| 31 |
|
| 32 |
@interface NSArray |
| 33 |
@end |
| 34 |
|
| 35 |
@interface NSArray (NSArrayCreation) |
| 36 |
+ (id)arrayWithObjects:(const id [])objects count:(unsigned long)cnt; |
| 37 |
@end |
| 38 |
|
| 39 |
@interface NSDictionary |
| 40 |
+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; |
| 41 |
@end |
| 42 |
|
| 43 |
template<typename T, typename U> |
| 44 |
struct pair { |
| 45 |
T first; |
| 46 |
U second; |
| 47 |
}; |
| 48 |
|
| 49 |
template<typename T, typename U> |
| 50 |
pair<T, U> make_pair(const T& first, const U& second) { |
| 51 |
return { first, second }; |
| 52 |
} |
| 53 |
|
| 54 |
// CHECK-IR: define linkonce_odr {{.*}}void @_Z29variadic_dictionary_expansionIJP8NSStringS1_EJP8NSNumberS3_EEvDp4pairIT_T0_E |
| 55 |
template<typename ...Ts, typename ... Us> |
| 56 |
void variadic_dictionary_expansion(pair<Ts, Us>... key_values) { |
| 57 |
// CHECK-PRINT: id dict = @{ key_values.first : key_values.second... }; |
| 58 |
// CHECK-IR: {{call.*objc_msgSend}} |
| 59 |
// CHECK-IR: ret void |
| 60 |
id dict = @{ key_values.first : key_values.second ... }; |
| 61 |
} |
| 62 |
|
| 63 |
#else |
| 64 |
void test_all() { |
| 65 |
variadic_dictionary_expansion(make_pair(@"Seventeen", @17), |
| 66 |
make_pair(@"YES", @true)); |
| 67 |
} |
| 68 |
#endif |