Another nasty code gen. bug with trivial fix. Calling class
method on 'super' receiver in a category implementation.
Other simpler cases were working by accident.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61880 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index dd72245..03f7b78 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -1244,7 +1244,9 @@
   // if know when we entered/exitted an implementation block.
 
   // Check for an existing forward reference.
-  if (llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name)) {
+  // Previously, metaclass with internal linkage may have been defined.
+  // pass 'true' as 2nd argument so it is returned.
+  if (llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true)) {
     assert(GV->getType()->getElementType() == ObjCTypes.ClassTy &&
            "Forward metaclass reference has incorrect type.");
     return GV;