[cfe-dev] Continuing Adventures with Objective-C

Devang Patel dpatel at apple.com
Wed May 14 18:05:51 PDT 2008


David,

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

> types.diff contains the changes to CodeGenTypes which allow  
> converting a return type.  This is required for the changes to  
> CodeGenFunction::GenerateObjCMethod().


> @@ -139,7 +144,7 @@
>    /// memory representation is usually i8 or i32, depending on the  
> target.
>    const llvm::Type *ConvertTypeForMem(QualType T);
>
> -  void CollectObjCIvarTypes(ObjCInterfaceDecl *ObjCClass,
> +  void CollectObjCIvarTypes(const ObjCInterfaceDecl *ObjCClass,
>        std::vector<const llvm::Type*> &IvarTypes);
>
>    const CGRecordLayout *getCGRecordLayout(const TagDecl*) const;
> Index: lib/CodeGen/CodeGenTypes.cpp
> ===================================================================
> --- lib/CodeGen/CodeGenTypes.cpp        (revision 51026)
> +++ lib/CodeGen/CodeGenTypes.cpp        (working copy)
> @@ -168,7 +168,7 @@
>  /// Produces a vector containing the all of the instance variables  
> in an
>  /// Objective-C object, in the order that they appear.  Used to  
> create LLVM
>  /// structures corresponding to Objective-C objects.
> -void CodeGenTypes::CollectObjCIvarTypes(ObjCInterfaceDecl *ObjCClass,
> +void CodeGenTypes::CollectObjCIvarTypes(const ObjCInterfaceDecl  
> *ObjCClass,
>                                      std::vector<const llvm::Type*>  
> &IvarTypes) {
>    ObjCInterfaceDecl *SuperClass = ObjCClass->getSuperClass();
>    if (SuperClass)

This is a separate and obvious patch.

> +const llvm::Type *CodeGenTypes::ConvertReturnType(QualType T) {
> +    if (T->isVoidType())
> +    {
> +      return llvm::Type::VoidTy;    // Result of function uses llvm  
> void.
> +    }
> +    else
> +      return ConvertType(T);
> +}
> +
> +

Please add doxygen style comment and drop extra { and }

> @@ -320,8 +325,8 @@
>      break;
>
>    case Type::ObjCQualifiedId:
> -    assert(0 && "FIXME: add missing functionality here");
> -    break;
> +    // For CodeGen purposes, any id type is an opque pointer
> +    return ConvertTypeRecursive(Context.getObjCIdType());
>
>    case Type::Tagged: {
>      const TagDecl *TD = cast<TagType>(Ty).getDecl();

This is independent and looks ok.

-
Devang



More information about the cfe-dev mailing list