diff options
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 15 |
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, |