diff options
| author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2013-05-15 21:40:27 +0200 |
|---|---|---|
| committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2013-05-15 21:40:27 +0200 |
| commit | b0274c7c30af17c0255846bcd53cac4f7d76ddea (patch) | |
| tree | 4243e33459039a96c26557de48f989e85c925a4c /test/Analysis/NSContainers.m | |
| parent | 38f7a3147aad1e25d0738356519cf9235f5c80b7 (diff) | |
| parent | cce70c7c5f0f4c1a41658fbed845f8b3a565c99c (diff) | |
| download | clang-embtk-support-master.tar.gz clang-embtk-support-master.tar.bz2 clang-embtk-support-master.tar.xz | |
Merge branch 'master' into embtk-support-masterembtk-support-master
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'test/Analysis/NSContainers.m')
| -rw-r--r-- | test/Analysis/NSContainers.m | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Analysis/NSContainers.m b/test/Analysis/NSContainers.m index 6b4089b3e5..959f367d28 100644 --- a/test/Analysis/NSContainers.m +++ b/test/Analysis/NSContainers.m @@ -36,6 +36,10 @@ typedef struct _NSZone NSZone; - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx __attribute__((availability(macosx,introduced=10.8))); @end +@interface NSArray (NSArrayCreation) ++ (instancetype)arrayWithObjects:(const id [])objects count:(NSUInteger)cnt; +@end + @interface NSMutableArray : NSArray - (void)addObject:(id)anObject; @@ -58,6 +62,8 @@ typedef struct _NSZone NSZone; + (id)dictionary; + (id)dictionaryWithObject:(id)object forKey:(id <NSCopying>)key; ++ (instancetype)dictionaryWithObjects:(const id [])objects forKeys:(const id <NSCopying> [])keys count:(NSUInteger)cnt; + @end @interface NSMutableDictionary : NSDictionary @@ -147,6 +153,33 @@ NSDictionary *testNilArgNSDictionary2(NSObject *obj) { return [NSDictionary dictionaryWithObject:obj forKey:0]; // expected-warning {{Key argument to 'dictionaryWithObject:forKey:' cannot be nil}} } +id testCreateDictionaryLiteralKey(id value, id nilKey) { + if (nilKey) + ; + return @{@"abc":value, nilKey:@"abc"}; // expected-warning {{Dictionary key cannot be nil}} +} + +id testCreateDictionaryLiteralValue(id nilValue) { + if (nilValue) + ; + return @{@"abc":nilValue}; // expected-warning {{Dictionary value cannot be nil}} +} + +id testCreateDictionaryLiteral(id nilValue, id nilKey) { + if (nilValue) + ; + if (nilKey) + ; + return @{@"abc":nilValue, nilKey:@"abc"}; // expected-warning {{Dictionary key cannot be nil}} + // expected-warning@-1 {{Dictionary value cannot be nil}} +} + +id testCreateArrayLiteral(id myNil) { + if (myNil) + ; + return @[ @"a", myNil, @"c" ]; // expected-warning {{Array element cannot be nil}} +} + // Test inline defensive checks suppression. void idc(id x) { if (x) |
