Correctly generate IR for ObjC messages sends to protocol-qualified types.

Fixes rdar://problem/7992749

llvm-svn: 103965
This commit is contained in:
John McCall 2010-05-17 20:12:43 +00:00
parent 0211a96989
commit 3e294929b8
2 changed files with 13 additions and 5 deletions

View File

@ -64,10 +64,11 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
break;
case ObjCMessageExpr::Class: {
const ObjCInterfaceType *IFace
= E->getClassReceiver()->getAs<ObjCInterfaceType>();
assert(IFace && "Invalid Objective-C class message send");
OID = IFace->getDecl();
const ObjCObjectType *ObjTy
= E->getClassReceiver()->getAs<ObjCObjectType>();
assert(ObjTy && "Invalid Objective-C class message send");
OID = ObjTy->getInterface();
assert(OID && "Invalid Objective-C class message send");
Receiver = Runtime.GetClass(Builder, OID);
isClassMessage = true;
break;

View File

@ -1,8 +1,9 @@
// RUN: %clang_cc1 -emit-llvm %s -o %t
// RUN: %clang_cc1 -emit-llvm-only %s
void p(const char*, ...);
@interface Root
+(int) maxValue;
-(int) conformsTo: (id) x;
@end
@ -48,3 +49,9 @@ int main() {
return 0;
}
// rdar://problem/7992749
typedef Root<P1> P1Object;
int test10() {
return [P1Object maxValue];
}