Fixes a code gen bug related to accessing a now

non-existing 'isa' field of a non-existing struct type
all related to legacy type definition for 'id' which we have
dropped in clang in favor of a built-in type.
(fixes radar 7470820).

llvm-svn: 91455
This commit is contained in:
Fariborz Jahanian 2009-12-15 21:34:52 +00:00
parent 6e997b2993
commit 2b9fc83db5
3 changed files with 13 additions and 1 deletions

View File

@ -1389,6 +1389,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
case CastExpr::CK_NoOp:
case CastExpr::CK_ConstructorConversion:
case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_AnyPointerToObjCPointerCast:
return EmitLValue(E->getSubExpr());
case CastExpr::CK_DerivedToBase: {

View File

@ -3584,7 +3584,9 @@ static CastExpr::CastKind getScalarCastKind(ASTContext &Context,
if (SrcTy->hasPointerRepresentation()) {
if (DestTy->hasPointerRepresentation())
return CastExpr::CK_BitCast;
return DestTy->isObjCObjectPointerType() ?
CastExpr::CK_AnyPointerToObjCPointerCast :
CastExpr::CK_BitCast;
if (DestTy->isIntegerType())
return CastExpr::CK_PointerToIntegral;
}

View File

@ -25,3 +25,12 @@ typedef struct objc_object {
}
@end
// rdar 7470820
static Class MyClass;
Class Test(const void *inObject1) {
if(((id)inObject1)->isa == MyClass)
return ((id)inObject1)->isa;
return (id)0;
}