[cfe-commits] r62289 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Chris Lattner clattner at apple.com
Thu Jan 15 19:42:06 PST 2009


On Jan 15, 2009, at 4:57 PM, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Thu Jan 15 18:57:08 2009
> New Revision: 62289
>
> URL: http://llvm.org/viewvc/llvm-project?rev=62289&view=rev
> Log:
> Implemented code gen for sizeof(objc class interface).

Nice!

> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Thu Jan 15 18:57:08 2009
> @@ -686,7 +686,14 @@
>     Align /= 8;  // Return alignment in bytes, not bits.
>     return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Align));
>   }
> -
> +  if (TypeToSize->isObjCInterfaceType()) {
> +    ObjCInterfaceDecl *OI = TypeToSize->getAsObjCInterfaceType()- 
> >getDecl();
> +    const RecordDecl *RD = CGF.getContext().addRecordToClass(OI);
> +    const Type *Key =
> +      CGF.getContext().getTagDeclType(
> +                     
> const_cast<TagDecl*>(dyn_cast<TagDecl>(RD))).getTypePtr();
> +    TypeToSize = Key->getDesugaredType();

Why call getDesugaredType?

-Chris




More information about the cfe-commits mailing list