[cfe-commits] r97672 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGenObjC/id-isa-codegen.m

Daniel Dunbar daniel at zuster.org
Thu Mar 4 05:24:53 PST 2010


Hi Fariborz,

Is it possible to write this test to actually check the output LLVM IR
to make sure that whatever error was fixed, is fixed?

 - Daniel

On Wed, Mar 3, 2010 at 2:09 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Wed Mar  3 16:09:47 2010
> New Revision: 97672
>
> URL: http://llvm.org/viewvc/llvm-project?rev=97672&view=rev
> Log:
> Fix code gen bug generating code for
> ((id)cat)->isa. Fixes radar 7709015.
>
>
> Modified:
>    cfe/trunk/lib/CodeGen/CGExprScalar.cpp
>    cfe/trunk/test/CodeGenObjC/id-isa-codegen.m
>
> Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=97672&r1=97671&r2=97672&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Mar  3 16:09:47 2010
> @@ -1888,6 +1888,8 @@
>     V = CreateTempAlloca(ClassPtrTy, "resval");
>     llvm::Value *Src = EmitScalarExpr(BaseExpr);
>     Builder.CreateStore(Src, V);
> +    LValue LV = LValue::MakeAddr(V, MakeQualifiers(E->getType()));
> +    V = ScalarExprEmitter(*this).EmitLoadOfLValue(LV, E->getType());
>   }
>   else {
>       if (E->isArrow())
>
> Modified: cfe/trunk/test/CodeGenObjC/id-isa-codegen.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/id-isa-codegen.m?rev=97672&r1=97671&r2=97672&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/id-isa-codegen.m (original)
> +++ cfe/trunk/test/CodeGenObjC/id-isa-codegen.m Wed Mar  3 16:09:47 2010
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -emit-llvm -o %t %s
> +// RUN: %clang_cc1 -emit-llvm -o - %s
>
>  typedef struct objc_class *Class;
>
> @@ -48,3 +48,19 @@
>       return (*[Foo method]).isa;
>     return [Foo method]->isa;
>  }
> +
> +// rdar 7709015
> + at interface Cat   {}
> + at end
> +
> + at interface SuperCat : Cat {}
> ++(void)geneticallyAlterCat:(Cat *)cat;
> + at end
> +
> + at implementation SuperCat
> ++ (void)geneticallyAlterCat:(Cat *)cat {
> +    Class dynamicSubclass;
> +    ((id)cat)->isa = dynamicSubclass;
> +}
> + at end
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list