[cfe-commits] r65955 - in /cfe/trunk: lib/CodeGen/CGObjC.cpp test/CodeGenObjC/objc2-retain-codegen.m
Daniel Dunbar
daniel at zuster.org
Sat Mar 14 23:21:07 PDT 2009
Hi Fariborz,
Its probably worth having an assert that the type is a pointer type if there
is a mismatch. Sema shouldn't let this through for other cases (like float
-> int) but its worth making this clear.
- Daniel
On Tue, Mar 3, 2009 at 11:49 AM, Fariborz Jahanian <fjahanian at apple.com>wrote:
> Author: fjahanian
> Date: Tue Mar 3 12:49:40 2009
> New Revision: 65955
>
> URL: http://llvm.org/viewvc/llvm-project?rev=65955&view=rev
> Log:
> Fixed an ir-gen bug in syntheszing a getter function
> with property type which does not match its ivar and
> in -fobjc-gc-only mode!
>
> Added:
> cfe/trunk/test/CodeGenObjC/objc2-retain-codegen.m
> Modified:
> cfe/trunk/lib/CodeGen/CGObjC.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=65955&r1=65954&r2=65955&view=diff
>
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Mar 3 12:49:40 2009
> @@ -205,9 +205,13 @@
> if (hasAggregateLLVMType(Ivar->getType())) {
> EmitAggregateCopy(ReturnValue, LV.getAddress(), Ivar->getType());
> }
> - else
> - EmitReturnOfRValue(EmitLoadOfLValue(LV, Ivar->getType()),
> - PD->getType());
> + else {
> + CodeGenTypes &Types = CGM.getTypes();
> + RValue RV = EmitLoadOfLValue(LV, Ivar->getType());
> + RV = RValue::get(Builder.CreateBitCast(RV.getScalarVal(),
> + Types.ConvertType(PD->getType())));
> + EmitReturnOfRValue(RV, PD->getType());
> + }
> }
>
> FinishFunction();
>
> Added: cfe/trunk/test/CodeGenObjC/objc2-retain-codegen.m
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc2-retain-codegen.m?rev=65955&view=auto
>
>
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/objc2-retain-codegen.m (added)
> +++ cfe/trunk/test/CodeGenObjC/objc2-retain-codegen.m Tue Mar 3 12:49:40
> 2009
> @@ -0,0 +1,12 @@
> +// RUN: clang -triple x86_64-unknown-unknown -fobjc-gc-only -emit-llvm -o
> %t %s
> +
> + at interface I0 {
> + I0 *_f0;
> +}
> + at property (retain) id p0;
> + at end
> +
> + at implementation I0
> + @synthesize p0 = _f0;
> + at end
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090314/036c6bb7/attachment.html>
More information about the cfe-commits
mailing list