Add more tests for NSArray/NSDictionary literals

llvm-svn: 229470
This commit is contained in:
Alex Denisov 2015-02-17 06:43:10 +00:00
parent 480e2b6e43
commit 10c4546498
2 changed files with 26 additions and 0 deletions

View File

@ -9,6 +9,18 @@ typedef unsigned long NSUInteger;
typedef unsigned int NSUInteger;
#endif
void checkNSArrayUnavailableDiagnostic() {
id obj;
id arr = @[obj]; // expected-error {{NSArray must be available to use Objective-C array literals}}
}
@class NSArray;
void checkNSArrayFDDiagnostic() {
id obj;
id arr = @[obj]; // expected-error {{declaration of 'arrayWithObjects:count:' is missing in NSArray class}}
}
@class NSString;
extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2)));

View File

@ -5,6 +5,20 @@
#define nil ((void *)0)
void checkNSDictionaryUnavailableDiagnostic() {
id key;
id value;
id dict = @{ key : value }; // expected-error {{NSDictionary must be available to use Objective-C dictionary literals}}
}
@class NSDictionary;
void checkNSDictionaryFDDiagnostic() {
id key;
id value;
id dic = @{ key : value }; // expected-error {{declaration of 'dictionaryWithObjects:forKeys:count:' is missing in NSDictionary class}}
}
@interface NSNumber
+ (NSNumber *)numberWithChar:(char)value;
+ (NSNumber *)numberWithInt:(int)value;