[cfe-commits] r91455 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp lib/Sema/SemaExpr.cpp test/CodeGenObjC/id-isa-codegen.m
Fariborz Jahanian
fjahanian at apple.com
Tue Dec 15 13:34:52 PST 2009
Author: fjahanian
Date: Tue Dec 15 15:34:52 2009
New Revision: 91455
URL: http://llvm.org/viewvc/llvm-project?rev=91455&view=rev
Log:
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).
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGenObjC/id-isa-codegen.m
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=91455&r1=91454&r2=91455&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Dec 15 15:34:52 2009
@@ -1389,6 +1389,7 @@
case CastExpr::CK_NoOp:
case CastExpr::CK_ConstructorConversion:
case CastExpr::CK_UserDefinedConversion:
+ case CastExpr::CK_AnyPointerToObjCPointerCast:
return EmitLValue(E->getSubExpr());
case CastExpr::CK_DerivedToBase: {
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=91455&r1=91454&r2=91455&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Dec 15 15:34:52 2009
@@ -3584,7 +3584,9 @@
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;
}
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=91455&r1=91454&r2=91455&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/id-isa-codegen.m (original)
+++ cfe/trunk/test/CodeGenObjC/id-isa-codegen.m Tue Dec 15 15:34:52 2009
@@ -25,3 +25,12 @@
}
@end
+
+// rdar 7470820
+static Class MyClass;
+
+Class Test(const void *inObject1) {
+ if(((id)inObject1)->isa == MyClass)
+ return ((id)inObject1)->isa;
+ return (id)0;
+}
More information about the cfe-commits
mailing list