}
} 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 =
&CGM.getModule());
UsedGlobals.push_back(SuperClassGV);
}
- IsAGV = SuperClassGV;
}
llvm::GlobalVariable *CLASS_RO_GV = BuildClassRoTInitializer(flags,
InstanceStart,
}
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);