Assert on a few conditions that (I believe) should hold
w.r.t. ASTContext::[gs]etFieldDecl, and the Field argument to
EmitObjCValueForIvar).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index d162307..3b5e0c5 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -2368,6 +2368,7 @@
                                        const ObjCIvarDecl *Ivar,
                                        const FieldDecl *Field,
                                        unsigned CVRQualifiers) {
+  assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
   if (Ivar->isBitField())
     return CGF.EmitLValueForBitfield(BaseValue, const_cast<FieldDecl *>(Field),
                                      CVRQualifiers);
@@ -4888,6 +4889,7 @@
                                              const ObjCIvarDecl *Ivar,
                                              const FieldDecl *Field,
                                              unsigned CVRQualifiers) {
+  assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
   assert(ObjectTy->isObjCInterfaceType() && 
          "CGObjCNonFragileABIMac::EmitObjCValueForIvar");
   ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();