[cfe-commits] r149279 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/arc.m

jahanian fjahanian at apple.com
Mon Jan 30 14:23:57 PST 2012


On Jan 30, 2012, at 2:08 PM, John McCall wrote:

> On Jan 30, 2012, at 1:40 PM, Fariborz Jahanian wrote:
>> -  RValue complete(CodeGenFunction &CGF, RValue result, QualType resultType) {
>> +  RValue complete(CodeGenFunction &CGF, RValue result, QualType resultType,
>> +                  const CallArgList &CallArgs,
>> +                  const ObjCMethodDecl *Method) {
>>    if (!NullBB) return result;
>> +    
>> +    llvm::Value *NullInitPtr = 0;
>> +    if (result.isScalar() && !resultType->isVoidType()) {
>> +      NullInitPtr = CGF.CreateTempAlloca(result.getScalarVal()->getType());
>> +      CGF.Builder.CreateStore(result.getScalarVal(), NullInitPtr);
>> +    }
> 
> I think you're missing the complex-number case here.

complex and structs valued method code are further down which is not part of my patch.

> 
>> +    if (result.isScalar()) {
>> +      if (NullInitPtr)
>> +        CGF.EmitNullInitialization(NullInitPtr, resultType);
>> +      // Jump to the continuation block.
>> +      CGF.EmitBlock(contBB);
>> +      return NullInitPtr ? RValue::get(CGF.Builder.CreateLoad(NullInitPtr)) 
>> +      : result;
>> +    }
> 
> And here.
> 
>> +  bool requiresnullCheck = false;
> 
> I'm not sure why this flag is necessary.

I wanted to avoid looping over method's parameter twice. 

> 
>> @@ -5785,7 +5833,8 @@
>>                                     llvm::PointerType::getUnqual(fnType));
>> 
>>  RValue result = CGF.EmitCall(fnInfo, callee, returnSlot, args);
>> -  return nullReturn.complete(CGF, result, resultType);
>> +  CallArgList CallArgs;
>> +  return nullReturn.complete(CGF, result, resultType, CallArgs, 0);
> 
> I think you want 'args' here instead of a new, empty CallArgList, and you
> should probably add a test for a v-table dispatch that consumes an
> argument.  @selector(isEqual:) should work.

I look into this.

- fariborz

> 
> John.




More information about the cfe-commits mailing list