[static analyzer] Don't flag nil storage into NSMutableDictionary.

This is now allowed and has the behavior of removing the mapping.

llvm-svn: 252679
This commit is contained in:
Anna Zaks 2015-11-11 00:49:22 +00:00
parent 2c98d0f477
commit de14eb5b4e
2 changed files with 2 additions and 4 deletions

View File

@ -307,8 +307,7 @@ void NilArgChecker::checkPreObjCMessage(const ObjCMethodCall &msg,
warnIfNilArg(C, msg, /* Arg */1, Class);
} else if (S == SetObjectForKeyedSubscriptSel) {
CanBeSubscript = true;
Arg = 0;
warnIfNilArg(C, msg, /* Arg */1, Class, CanBeSubscript);
Arg = 1;
} else if (S == RemoveObjectForKeySel) {
Arg = 0;
}

View File

@ -155,13 +155,12 @@ void testNilArgNSMutableDictionary3(NSMutableDictionary *d) {
}
void testNilArgNSMutableDictionary5(NSMutableDictionary *d, NSString* key) {
d[key] = 0; // expected-warning {{Value stored into 'NSMutableDictionary' cannot be nil}}
d[key] = 0; // no-warning - removing the mapping for the given key
}
void testNilArgNSMutableDictionary6(NSMutableDictionary *d, NSString *key) {
if (key)
;
d[key] = 0; // expected-warning {{'NSMutableDictionary' key cannot be nil}}
// expected-warning@-1 {{Value stored into 'NSMutableDictionary' cannot be nil}}
}
NSDictionary *testNilArgNSDictionary1(NSString* key) {