[cfe-commits] r59575 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h CGValue.h

Daniel Dunbar daniel at zuster.org
Wed Nov 19 03:45:16 PST 2008


A few more comments:

On Tue, Nov 18, 2008 at 4:59 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Tue Nov 18 18:59:10 2008
> New Revision: 59575
>
> URL: http://llvm.org/viewvc/llvm-project?rev=59575&view=rev
> Log:
> Generate strong write barriers for __strong objects.
> Also, took care of Daniel's commments.
>
> Modified:
>    cfe/trunk/lib/CodeGen/CGExpr.cpp
>    cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
>    cfe/trunk/lib/CodeGen/CGObjCMac.cpp
>    cfe/trunk/lib/CodeGen/CGObjCRuntime.h
>    cfe/trunk/lib/CodeGen/CGValue.h
>
> Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=59575&r1=59574&r2=59575&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Nov 18 18:59:10 2008
> @@ -151,7 +151,7 @@
>  /// this method emits the address of the lvalue, then loads the result as an
>  /// rvalue, returning the rvalue.
>  RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, QualType ExprType) {
> -  if (LV.isObjcWeak()) {
> +  if (LV.ObjcWeak()) {

Err, guess I wasn't clear. I meant "isObjCWeak" instead of
"isObjcWeak" (capitalized C).

>
> +  if (Dst.ObjcStrong()) {
> +    // load of a __strong object.
> +    llvm::Value *LvalueDst = Dst.getAddress();
> +    llvm::Value *src = Src.getScalarVal();
> +    CGM.getObjCRuntime().EmitObjCGlobalAssign(*this, src, LvalueDst);
> +    return;
> +  }

Both this and the weak code only apply to simple LValues, I think this
code can be moved after the test of Dst.isSimple() below:

> +
>   if (!Dst.isSimple()) {

Additionally, I believe that this code will need to add casts to the
appropriate type of the dst and src values, since these may have
arbitrary LLVM types but the LLVM runtime functions with expect types
like id or id*.

 - Daniel



More information about the cfe-commits mailing list