[cfe-commits] r65548 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Fariborz Jahanian fjahanian at apple.com
Thu Feb 26 10:23:48 PST 2009


Author: fjahanian
Date: Thu Feb 26 12:23:47 2009
New Revision: 65548

URL: http://llvm.org/viewvc/llvm-project?rev=65548&view=rev
Log:
Fix an inconsistance in objc2's meta-data related to
the symbol for the root meta-data.

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=65548&r1=65547&r2=65548&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Feb 26 12:23:47 2009
@@ -3683,9 +3683,23 @@
     }
   } else {
     // Has a root. Current class is not a root.
-    std::string RootClassName = 
-      ID->getClassInterface()->getSuperClass()->getNameAsString();
-    std::string SuperClassName = ObjCMetaClassName + RootClassName;
+    const ObjCInterfaceDecl *Root = ID->getClassInterface();
+    while (const ObjCInterfaceDecl *Super = Root->getSuperClass())
+      Root = Super;
+    std::string RootClassName = ObjCMetaClassName + Root->getNameAsString();
+    IsAGV = CGM.getModule().getGlobalVariable(RootClassName);
+    if (!IsAGV) {
+      IsAGV = 
+        new llvm::GlobalVariable(ObjCTypes.ClassnfABITy, false,
+                                 llvm::GlobalValue::ExternalLinkage,
+                                 0,
+                                 RootClassName,
+                                 &CGM.getModule());
+      UsedGlobals.push_back(IsAGV);
+    }
+    // work on super class metadata symbol.
+    std::string SuperClassName =  
+      ObjCMetaClassName + ID->getClassInterface()->getSuperClass()->getNameAsString();
     SuperClassGV = CGM.getModule().getGlobalVariable(SuperClassName);
     if (!SuperClassGV) {
       SuperClassGV = 
@@ -3696,7 +3710,6 @@
                                  &CGM.getModule());
       UsedGlobals.push_back(SuperClassGV);
     }
-    IsAGV = SuperClassGV;
   }
   llvm::GlobalVariable *CLASS_RO_GV = BuildClassRoTInitializer(flags,
                                                                InstanceStart,
@@ -3716,7 +3729,7 @@
   }
   else {
     // Has a root. Current class is not a root.
-    std::string RootClassName = 
+    std::string RootClassName =
       ID->getClassInterface()->getSuperClass()->getNameAsString();
     std::string SuperClassName = ObjCClassName + RootClassName;
     SuperClassGV = CGM.getModule().getGlobalVariable(SuperClassName);





More information about the cfe-commits mailing list