summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-01-30 23:39:30 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-01-30 23:39:30 +0000
commitc93fa98e4c10ee948d05ddbe73117eff6b03b8e5 (patch)
treea637c7b54840f29859c9319fbfb98f6c6f52c48a /clang/lib/CodeGen/CGObjCMac.cpp
parent3926837056d4fc4d720f3f77adf7159f8f0e21bb (diff)
downloadbcm5719-llvm-c93fa98e4c10ee948d05ddbe73117eff6b03b8e5.tar.gz
bcm5719-llvm-c93fa98e4c10ee948d05ddbe73117eff6b03b8e5.zip
test for a v-table dispatch that consumes an
argument. twik to support the test case. // rdar://10444476 llvm-svn: 149298
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 0133ad2dbde..8f5fbe656e1 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5816,6 +5816,20 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF,
messageRef->setAlignment(16);
messageRef->setSection("__DATA, __objc_msgrefs, coalesced");
}
+
+ bool requiresnullCheck = false;
+ if (CGM.getLangOptions().ObjCAutoRefCount && method)
+ for (ObjCMethodDecl::param_const_iterator i = method->param_begin(),
+ e = method->param_end(); i != e; ++i) {
+ const ParmVarDecl *ParamDecl = (*i);
+ if (ParamDecl->hasAttr<NSConsumedAttr>()) {
+ if (!nullReturn.NullBB)
+ nullReturn.init(CGF, arg0);
+ requiresnullCheck = true;
+ break;
+ }
+ }
+
llvm::Value *mref =
CGF.Builder.CreateBitCast(messageRef, ObjCTypes.MessageRefPtrTy);
@@ -5833,8 +5847,8 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF,
llvm::PointerType::getUnqual(fnType));
RValue result = CGF.EmitCall(fnInfo, callee, returnSlot, args);
- CallArgList CallArgs;
- return nullReturn.complete(CGF, result, resultType, CallArgs, 0);
+ return nullReturn.complete(CGF, result, resultType, formalArgs,
+ requiresnullCheck ? method : 0);
}
/// Generate code for a message send expression in the nonfragile abi.
OpenPOWER on IntegriCloud