"This patch fixes message sends to super in class methods for the GNU runtime (currently an instance method lookup is being performed)."

Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69493 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index cd94290..c5e2538 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -299,8 +299,9 @@
   const ObjCInterfaceDecl *SuperClass = Class->getSuperClass();
   // TODO: This should be cached, not looked up every time.
   llvm::Value *ReceiverClass = GetClass(CGF.Builder, SuperClass);
-
-
+  if (IsClassMessage)
+    ReceiverClass = CGF.Builder.CreateBitCast(CGF.Builder.CreateLoad(
+      CGF.Builder.CreateStructGEP(ReceiverClass, 0)), IdTy);
   // Construct the structure used to look up the IMP
   llvm::StructType *ObjCSuperTy = llvm::StructType::get(Receiver->getType(),
       IdTy, NULL);