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.

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

Reply via email to