The ivars in an ObjCImplementationDecl are now stored in the
DeclContext rather than in a separate list. This makes PCH
(de-)serialization trivial, so that ivars can be loaded lazily.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69857 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 040c546..c7a45dc 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3952,7 +3952,12 @@
     } else if (ObjCImplementationDecl *IMPDecl = 
                   dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
       assert(IMPDecl && "ActOnFields - missing ObjCImplementationDecl");
-      IMPDecl->setIVarList(ClsFields, RecFields.size(), Context);
+      for (unsigned I = 0, N = RecFields.size(); I != N; ++I) {
+        // FIXME: Set the DeclContext correctly when we build the
+        // declarations.
+        ClsFields[I]->setLexicalDeclContext(IMPDecl);
+        IMPDecl->addDecl(Context, ClsFields[I]);
+      }
       CheckImplementationIvars(IMPDecl, ClsFields, RecFields.size(), RBrac);
     }
   }