diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-26 18:23:47 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-26 18:23:47 +0000 |
| commit | 03b300b734dc5399c8dc84ae346e8b1ccbef596a (patch) | |
| tree | 5f26739db37215370657aa0230a8dbd2abce4182 /clang/lib | |
| parent | 42ab0dd1eef7cce0f85d12fcada12cf8c1b6afc4 (diff) | |
| download | bcm5719-llvm-03b300b734dc5399c8dc84ae346e8b1ccbef596a.tar.gz bcm5719-llvm-03b300b734dc5399c8dc84ae346e8b1ccbef596a.zip | |
Fix an inconsistance in objc2's meta-data related to
the symbol for the root meta-data.
llvm-svn: 65548
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index ca12f83a9bc..0fddd2b023d 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -3683,9 +3683,23 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { } } 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 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { &CGM.getModule()); UsedGlobals.push_back(SuperClassGV); } - IsAGV = SuperClassGV; } llvm::GlobalVariable *CLASS_RO_GV = BuildClassRoTInitializer(flags, InstanceStart, @@ -3716,7 +3729,7 @@ void CGObjCNonFragileABIMac::GenerateClass(const ObjCImplementationDecl *ID) { } 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); |

