On Feb 13, 2011, at 12:07 PM, Fariborz Jahanian wrote:

> 
> On Feb 13, 2011, at 11:33 AM, John McCall wrote:
> 
>> On Feb 12, 2011, at 11:07 AM, Fariborz Jahanian wrote:
>>> Author: fjahanian
>>> Date: Sat Feb 12 13:07:46 2011
>>> New Revision: 125445
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=125445&view=rev
>>> Log:
>>> Implement objective-c++'s block pointer type matching involving
>>> types which are contravariance in argument types and covariance
>>> in return types. // rdar://8979379.
>> 
>> To add to Doug's comments:
>> 
>>> +  const FunctionProtoType *FromFunctionType
>>> +    = FromPointeeType->getAs<FunctionProtoType>();
>>> +  const FunctionProtoType *ToFunctionType
>>> +    = ToPointeeType->getAs<FunctionProtoType>();
>>> +  
>>> +  if (FromFunctionType && ToFunctionType) {
>> 
>> You can use an early return here.
>> 
>>> +    if (Context.getCanonicalType(FromPointeeType)
>>> +          == Context.getCanonicalType(ToPointeeType))
>>> +      return true;
>>> +    
>>> +    // Perform the quick checks that will tell us whether these
>>> +    // function types are obviously different.
>>> +    if (FromFunctionType->getNumArgs() != ToFunctionType->getNumArgs() ||
>>> +        FromFunctionType->isVariadic() != ToFunctionType->isVariadic() ||
>>> +        FromFunctionType->getTypeQuals() != ToFunctionType->getTypeQuals())
>>> +      return false;
>> 
>> You should bail out on an ExtInfo mismatch, too.
> 
> Thanks. In r125467 now. What does checking for ExtInfo accomplish beyond the 
> other
> checkings? 

You can give a block a non-standard calling convention.  You generally 
*shouldn't*, because things like invoking the block via an Objective-C message 
send will completely break, but you *can*.

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to