summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC
diff options
context:
space:
mode:
authorAlex Denisov <1101.debian@gmail.com>2015-02-17 06:43:10 +0000
committerAlex Denisov <1101.debian@gmail.com>2015-02-17 06:43:10 +0000
commit10c45464981b0e9c81d7549ed5f85e56cfe19072 (patch)
tree54b048761575c786a0964ede97523f412287aa47 /clang/test/SemaObjC
parent480e2b6e4398627d5719d086fa678f093bfabf18 (diff)
downloadbcm5719-llvm-10c45464981b0e9c81d7549ed5f85e56cfe19072.tar.gz
bcm5719-llvm-10c45464981b0e9c81d7549ed5f85e56cfe19072.zip
Add more tests for NSArray/NSDictionary literals
llvm-svn: 229470
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r--clang/test/SemaObjC/objc-array-literal.m12
-rw-r--r--clang/test/SemaObjC/objc-dictionary-literal.m14
2 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/objc-array-literal.m b/clang/test/SemaObjC/objc-array-literal.m
index 706207df748..2971fcc4539 100644
--- a/clang/test/SemaObjC/objc-array-literal.m
+++ b/clang/test/SemaObjC/objc-array-literal.m
@@ -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)));
diff --git a/clang/test/SemaObjC/objc-dictionary-literal.m b/clang/test/SemaObjC/objc-dictionary-literal.m
index f9fd57f2dae..87f127f9281 100644
--- a/clang/test/SemaObjC/objc-dictionary-literal.m
+++ b/clang/test/SemaObjC/objc-dictionary-literal.m
@@ -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;
OpenPOWER on IntegriCloud