Use the implementation decl for looking up offset while building the
ivar layout.
 - The layout needs access to synthesized ivars.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70798 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index a5450ff..5d4b65f 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -821,7 +821,7 @@
   void BuildAggrIvarRecordLayout(const RecordType *RT,
                            unsigned int BytePos, bool ForStrongLayout,
                            bool &HasUnion);
-  void BuildAggrIvarLayout(const ObjCInterfaceDecl *OI,
+  void BuildAggrIvarLayout(const ObjCImplementationDecl *OI,
                            const llvm::StructLayout *Layout,
                            const RecordDecl *RD,
                            const llvm::SmallVectorImpl<FieldDecl*> &RecFields,
@@ -846,7 +846,7 @@
   llvm::Constant *GetProtocolRef(const ObjCProtocolDecl *PD);
 
   /// GetFieldBaseOffset - return's field byte offset.
-  uint64_t GetFieldBaseOffset(const ObjCInterfaceDecl *OI,
+  uint64_t GetFieldBaseOffset(const ObjCImplementationDecl *OI,
                               const llvm::StructLayout *Layout,
                               const FieldDecl *Field);
   
@@ -2229,7 +2229,7 @@
 }
 
 /// GetFieldBaseOffset - return the field's byte offset.
-uint64_t CGObjCCommonMac::GetFieldBaseOffset(const ObjCInterfaceDecl *OI,
+uint64_t CGObjCCommonMac::GetFieldBaseOffset(const ObjCImplementationDecl *OI,
                                              const llvm::StructLayout *Layout,
                                              const FieldDecl *Field) {
   // Is this a C struct?
@@ -2935,7 +2935,7 @@
                       ForStrongLayout, HasUnion);
 }
 
-void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCInterfaceDecl *OI,
+void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI,
                               const llvm::StructLayout *Layout,
                               const RecordDecl *RD,
                              const llvm::SmallVectorImpl<FieldDecl*> &RecFields,
@@ -3109,7 +3109,7 @@
   SkipIvars.clear(); 
   IvarsInfo.clear();
   
-  BuildAggrIvarLayout(OI, 0, 0, RecFields, 0, ForStrongLayout, hasUnion);
+  BuildAggrIvarLayout(OMD, 0, 0, RecFields, 0, ForStrongLayout, hasUnion);
   if (IvarsInfo.empty())
     return llvm::Constant::getNullValue(PtrTy);