diff options
author | John McCall <rjmccall@apple.com> | 2010-05-17 20:12:43 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-17 20:12:43 +0000 |
commit | 3031c63f7b5b09d5f64609fa7a1922a05b520fa7 (patch) | |
tree | d829394f1b2097bb0326dec4e5d2e72b386d30fb | |
parent | 9ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3b (diff) |
Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103965 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 9 | ||||
-rw-r--r-- | test/CodeGenObjC/protocols.m | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index ce048405af..9943a3b700 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -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; diff --git a/test/CodeGenObjC/protocols.m b/test/CodeGenObjC/protocols.m index 0f24a1cd1f..6dadb11273 100644 --- a/test/CodeGenObjC/protocols.m +++ b/test/CodeGenObjC/protocols.m @@ -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]; +} |