r229470 - Add more tests for NSArray/NSDictionary literals
Alex Denisov
1101.debian at gmail.com
Mon Feb 16 22:43:11 PST 2015
Author: alexdenisov
Date: Tue Feb 17 00:43:10 2015
New Revision: 229470
URL: http://llvm.org/viewvc/llvm-project?rev=229470&view=rev
Log:
Add more tests for NSArray/NSDictionary literals
Modified:
cfe/trunk/test/SemaObjC/objc-array-literal.m
cfe/trunk/test/SemaObjC/objc-dictionary-literal.m
Modified: cfe/trunk/test/SemaObjC/objc-array-literal.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-array-literal.m?rev=229470&r1=229469&r2=229470&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/objc-array-literal.m (original)
+++ cfe/trunk/test/SemaObjC/objc-array-literal.m Tue Feb 17 00:43:10 2015
@@ -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}}
+}
+
+ at 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)));
Modified: cfe/trunk/test/SemaObjC/objc-dictionary-literal.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/objc-dictionary-literal.m?rev=229470&r1=229469&r2=229470&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/objc-dictionary-literal.m (original)
+++ cfe/trunk/test/SemaObjC/objc-dictionary-literal.m Tue Feb 17 00:43:10 2015
@@ -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}}
+}
+
+ at 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;
More information about the cfe-commits
mailing list