diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-03 22:09:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-03 22:09:47 +0000 |
commit | 281aae63285d326608759dd095d64036d630d657 (patch) | |
tree | 7e22a97546bd56bfef7c50f2e0d2a7317bf8a0cd /clang | |
parent | aabec2fb8433f52a00b776c9e250fc6e2c9a7d0f (diff) | |
download | bcm5719-llvm-281aae63285d326608759dd095d64036d630d657.tar.gz bcm5719-llvm-281aae63285d326608759dd095d64036d630d657.zip |
Fix code gen bug generating code for
((id)cat)->isa. Fixes radar 7709015.
llvm-svn: 97672
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/id-isa-codegen.m | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index db0998b4ded..7e26971414b 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -1888,6 +1888,8 @@ LValue CodeGenFunction::EmitObjCIsaExpr(const ObjCIsaExpr *E) { 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()) diff --git a/clang/test/CodeGenObjC/id-isa-codegen.m b/clang/test/CodeGenObjC/id-isa-codegen.m index 3179e11b7f3..e893aaa4f3c 100644 --- a/clang/test/CodeGenObjC/id-isa-codegen.m +++ b/clang/test/CodeGenObjC/id-isa-codegen.m @@ -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 @@ id Test2() { return (*[Foo method]).isa; return [Foo method]->isa; } + +// rdar 7709015 +@interface Cat {} +@end + +@interface SuperCat : Cat {} ++(void)geneticallyAlterCat:(Cat *)cat; +@end + +@implementation SuperCat ++ (void)geneticallyAlterCat:(Cat *)cat { + Class dynamicSubclass; + ((id)cat)->isa = dynamicSubclass; +} +@end + |