Hi Fariborz,<br><br>Two comments:<br><br>1. There is a lot of duplicate code here! First, can these methods move into the common base class? Second, why not have a single function which does this work and takes the function to call as a parameter.<br>
<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Mar 12 19:42:52 2009<br>
@@ -2239,6 +2239,10 @@<br>
 void CGObjCMac::EmitObjCWeakAssign(CodeGen::CodeGenFunction &CGF,<br>
                                    llvm::Value *src, llvm::Value *dst)<br>
 {<br>
+  if (!isa<llvm::PointerType>(src->getType())) {<br>
+    src = CGF.Builder.CreateBitCast(src, ObjCTypes.LongTy);<br>
+    src = CGF.Builder.CreateIntToPtr(src, ObjCTypes.Int8PtrTy);<br>
+  }<br>
   src = CGF.Builder.CreateBitCast(src, ObjCTypes.ObjectPtrTy);</blockquote><div><br>2. The inttoptr instruction can cast from an arbitrary integer type, there is no need to explicitly cast to long. This could could look like:<br>
--<br>if (!isa<llvm::PointerType>(src->getType()))<br>  src = CGF.Builder.CreateIntToPtr(src, ObjCTypes.ObjectPtrTy);<br>else<br>  src = CGF.Builder.CreateBitCast(src, ObjCTypes.ObjectPtrTy);<br>--<br><br> - Daniel<br>
<br></div></div><br>