summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2014-08-07 20:57:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2014-08-07 20:57:35 +0000
commitd45e7cec42aeef87eef76996186597b9a5663de8 (patch)
treecf877eae5427e02dde0d918da21552ceefdbc47f /clang/lib/Sema/SemaExprObjC.cpp
parent88d99e4f427350dc788a6a0a71c2f93be59a7cde (diff)
downloadbcm5719-llvm-d45e7cec42aeef87eef76996186597b9a5663de8.tar.gz
bcm5719-llvm-d45e7cec42aeef87eef76996186597b9a5663de8.zip
Objective-C arc. Switch the Objective-C dictionary literal in ARC mode
to use non-retain/autorelease API variants of ObjC objects. wip. rdar://17554063 llvm-svn: 215146
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index b4d3d4de363..e4625bc98c2 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -792,19 +792,22 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
}
}
- // Find the dictionaryWithObjects:forKeys:count: method, if we haven't done
- // so already.
+ // Find the dictionaryWithObjects:forKeys:count: or initWithObjects:forKeys:count:
+ // (for arc) method, if we haven't done so already.
if (!DictionaryWithObjectsMethod) {
- Selector Sel = NSAPIObj->getNSDictionarySelector(
- NSAPI::NSDict_dictionaryWithObjectsForKeysCount);
- ObjCMethodDecl *Method = NSDictionaryDecl->lookupClassMethod(Sel);
+ Selector Sel =
+ NSAPIObj->getNSDictionarySelector(Arc? NSAPI::NSDict_initWithObjectsForKeysCount
+ : NSAPI::NSDict_dictionaryWithObjectsForKeysCount);
+ ObjCMethodDecl *Method =
+ Arc ? NSDictionaryDecl->lookupInstanceMethod(Sel)
+ : NSDictionaryDecl->lookupClassMethod(Sel);
if (!Method && getLangOpts().DebuggerObjCLiteral) {
Method = ObjCMethodDecl::Create(Context,
SourceLocation(), SourceLocation(), Sel,
IdT,
nullptr /*TypeSourceInfo */,
Context.getTranslationUnitDecl(),
- false /*Instance*/, false/*isVariadic*/,
+ Arc /*Instance for Arc, Class for MRR*/, false/*isVariadic*/,
/*isPropertyAccessor=*/false,
/*isImplicitlyDeclared=*/true, /*isDefined=*/false,
ObjCMethodDecl::Required,
OpenPOWER on IntegriCloud