[cfe-dev] cast.diff [ Re: Continuing Adventures with Objective-C]

Devang Patel dpatel at apple.com
Fri May 16 09:54:57 PDT 2008


On May 13, 2008, at 9:22 AM, David Chisnall wrote:

> cast.diff fixes a number of cases where implicit casts are not  
> correctly codegen'd, and allows Objective-C const id to have  
> messages sent to it.


> Index: lib/CodeGen/CodeGenFunction.h
> ===================================================================
> --- lib/CodeGen/CodeGenFunction.h       (revision 51026)
> +++ lib/CodeGen/CodeGenFunction.h       (working copy)
> @@ -67,7 +67,9 @@
>    class ChooseExpr;
>    class PreDefinedExpr;
>    class ObjCStringLiteral;
> +  class ObjCSelectorExpr;
>    class ObjCIvarRefExpr;
> +  class ObjCMessageExpr;
>    class MemberExpr;
>
>    class VarDecl;
> @@ -296,11 +298,15 @@

Do you need this ? I don't see any use in this patch.

>
>
>    void GenerateObjCMethod(const ObjCMethodDecl *OMD);
>    void GenerateCode(const FunctionDecl *FD);
>
>    const llvm::Type *ConvertType(QualType T);
>
>    llvm::Value *LoadObjCSelf();
>
> +  /// isObjCPointerType - Return true if the specificed AST type  
> will map onto
> +  /// some Objective-C pointer type.
> +  static bool isObjCPointerType(QualType T);
>    /// hasAggregateLLVMType - Return true if the specified AST type  
> will map into
>    /// an aggregate LLVM type or is void.
>    static bool hasAggregateLLVMType(QualType T);

> Index: lib/CodeGen/CodeGenFunction.cpp
> ===================================================================
> --- lib/CodeGen/CodeGenFunction.cpp     (revision 51026)
> +++ lib/CodeGen/CodeGenFunction.cpp     (working copy)
> @@ -50,70 +54,20 @@
>    return CGM.getTypes().ConvertType(T);
>  }
>
> +bool CodeGenFunction::isObjCPointerType(QualType T) {
> +  // All Objective-C types are pointers.
> +  return T->isObjCInterfaceType() ||
> +    T->isObjCQualifiedInterfaceType() || T->isObjCQualifiedIdType();
> +}
> +
>  bool CodeGenFunction::hasAggregateLLVMType(QualType T) {
> -  return !T->isRealType() && !T->isPointerLikeType() &&
> -         !T->isVoidType() && !T->isVectorType() && !T- 
> >isFunctionType();
> +  return !isObjCPointerType(T) &&!T->isRealType() && !T- 
> >isPointerLikeType() &&
> +    !T->isVoidType() && !T->isVectorType() && !T->isFunctionType();
>  }


This is part of patch OK. I think, Eli addressed other part.
-
Devang



More information about the cfe-dev mailing list