summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/NSAPI.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-16 23:54:48 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-16 23:54:48 +0000
commit6b4f341ecd9bf0cb5e400901cb2ccf208ef9a640 (patch)
tree7ec1756af33977990f552b53bc83f92afd361263 /clang/lib/AST/NSAPI.cpp
parentb3069002004a99104d2db1c62886a666c37af09c (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 llvm-svn: 172679
Diffstat (limited to 'clang/lib/AST/NSAPI.cpp')
-rw-r--r--clang/lib/AST/NSAPI.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/AST/NSAPI.cpp b/clang/lib/AST/NSAPI.cpp
index b92b08c9933b..35cc7d050bdf 100644
--- a/clang/lib/AST/NSAPI.cpp
+++ b/clang/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;