Fix code gen bug generating code for

((id)cat)->isa. Fixes radar 7709015.

llvm-svn: 97672
This commit is contained in:
Fariborz Jahanian 2010-03-03 22:09:47 +00:00
parent aabec2fb84
commit 281aae6328
2 changed files with 19 additions and 1 deletions

View File

@ -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())

View File

@ -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