[cfe-commits] r126544 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
John McCall
rjmccall at apple.com
Sat Feb 26 01:48:59 PST 2011
Author: rjmccall
Date: Sat Feb 26 03:48:59 2011
New Revision: 126544
URL: http://llvm.org/viewvc/llvm-project?rev=126544&view=rev
Log:
Don't assume that whoever is asking for a message send is going
to give us a non-null return slot.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=126544&r1=126543&r2=126544&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sat Feb 26 03:48:59 2011
@@ -46,6 +46,15 @@
// don't belong in CGObjCRuntime either so we will live with it for
// now.
+static void EmitNullReturnInitialization(CodeGenFunction &CGF,
+ ReturnValueSlot &returnSlot,
+ QualType resultType) {
+ // Force the return slot to exist.
+ if (!returnSlot.getValue())
+ returnSlot = ReturnValueSlot(CGF.CreateMemTemp(resultType), false);
+ CGF.EmitNullInitialization(returnSlot.getValue(), resultType);
+}
+
static uint64_t LookupFieldBitOffset(CodeGen::CodeGenModule &CGM,
const ObjCInterfaceDecl *OID,
const ObjCImplementationDecl *ID,
@@ -1639,7 +1648,7 @@
llvm::Constant *Fn = NULL;
if (CGM.ReturnTypeUsesSRet(FnInfo)) {
- CGF.EmitNullInitialization(Return.getValue(), ResultType);
+ EmitNullReturnInitialization(CGF, Return, ResultType);
Fn = (ObjCABI == 2) ? ObjCTypes.getSendStretFn2(IsSuper)
: ObjCTypes.getSendStretFn(IsSuper);
} else if (CGM.ReturnTypeUsesFPRet(ResultType)) {
@@ -5630,7 +5639,7 @@
llvm::Constant *Fn = 0;
std::string Name("\01l_");
if (CGM.ReturnTypeUsesSRet(FnInfo)) {
- CGF.EmitNullInitialization(Return.getValue(), ResultType);
+ EmitNullReturnInitialization(CGF, Return, ResultType);
if (IsSuper) {
Fn = ObjCTypes.getMessageSendSuper2StretFixupFn();
Name += "objc_msgSendSuper2_stret_fixup";
More information about the cfe-commits
mailing list