diff options
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r-- | lib/CodeGen/CGObjCMac.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 201f53e34d..33dfff1030 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -1328,9 +1328,12 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID, for (ObjCInterfaceDecl::ivar_iterator i = ID->getClassInterface()->ivar_begin(), e = ID->getClassInterface()->ivar_end(); i != e; ++i) { - ObjCIvarDecl *V = *i; + const ObjCIvarDecl *V = *i; + ObjCInterfaceDecl *OID = + const_cast<ObjCInterfaceDecl *>(ID->getClassInterface()); + FieldDecl *Field = OID->lookupFieldDeclForIvar(CGM.getContext(), V); unsigned Offset = - Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(V)); + Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field)); std::string TypeStr; Ivar[0] = GetMethodVarName(V->getIdentifier()); CGM.getContext().getObjCEncodingForType(V->getType(), TypeStr, true); |