diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-16 23:54:48 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-16 23:54:48 +0000 |
commit | a44b97004298a4eb7c270009ea4cb12aad49c543 (patch) | |
tree | 92e67c31b5a90cdf30d6644414185ed85543e5a4 /lib/AST/NSAPI.cpp | |
parent | 4d8a33b4cea46948f86afccf0ad3675aff924148 (diff) |
[objcmt] Rewrite a NSDictionary dictionaryWithObjects:forKeys: to a dictionary literal
if we can see the elements of the arrays.
for example:
NSDictionary *dict = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"1", @"2", nil] forKeys:[NSArray arrayWithObjects:@"A", @"B", nil]];
-->
NSDictionary *dict = @{ @"A" : @"1", @"B" : @"2" };
rdar://12428166
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172679 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/NSAPI.cpp')
-rw-r--r-- | lib/AST/NSAPI.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/NSAPI.cpp b/lib/AST/NSAPI.cpp index b92b08c993..35cc7d050b 100644 --- a/lib/AST/NSAPI.cpp +++ b/lib/AST/NSAPI.cpp @@ -186,6 +186,14 @@ Selector NSAPI::getNSDictionarySelector( Sel = Ctx.Selectors.getUnarySelector( &Ctx.Idents.get("initWithObjectsAndKeys")); break; + case NSDict_initWithObjectsForKeys: { + IdentifierInfo *KeyIdents[] = { + &Ctx.Idents.get("initWithObjects"), + &Ctx.Idents.get("forKeys") + }; + Sel = Ctx.Selectors.getSelector(2, KeyIdents); + break; + } case NSDict_objectForKey: Sel = Ctx.Selectors.getUnarySelector(&Ctx.Idents.get("objectForKey")); break; |