Kill ASTContext::[gs]etFieldForDecl, instead we just lookup things
when we need them -- which is exactly what some code was already
doing!
 - No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69648 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 3b5e0c5..58cfe8e 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -701,7 +701,6 @@
                                       QualType ObjectTy,
                                       llvm::Value *BaseValue,
                                       const ObjCIvarDecl *Ivar,
-                                      const FieldDecl *Field,
                                       unsigned CVRQualifiers);
   virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
                                       ObjCInterfaceDecl *Interface,
@@ -891,7 +890,6 @@
                                       QualType ObjectTy,
                                       llvm::Value *BaseValue,
                                       const ObjCIvarDecl *Ivar,
-                                      const FieldDecl *Field,
                                       unsigned CVRQualifiers);
   virtual llvm::Value *EmitIvarOffset(CodeGen::CodeGenFunction &CGF,
                                       ObjCInterfaceDecl *Interface,
@@ -2366,9 +2364,9 @@
                                        QualType ObjectTy,
                                        llvm::Value *BaseValue,
                                        const ObjCIvarDecl *Ivar,
-                                       const FieldDecl *Field,
                                        unsigned CVRQualifiers) {
-  assert(Field == ObjectTy->getAsObjCInterfaceType()->getDecl()->lookupFieldDeclForIvar(CGM.getContext(), Ivar));
+  const ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();
+  const FieldDecl *Field = ID->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
   if (Ivar->isBitField())
     return CGF.EmitLValueForBitfield(BaseValue, const_cast<FieldDecl *>(Field),
                                      CVRQualifiers);
@@ -4887,12 +4885,9 @@
                                              QualType ObjectTy,
                                              llvm::Value *BaseValue,
                                              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();
+  const ObjCInterfaceDecl *ID = ObjectTy->getAsObjCInterfaceType()->getDecl();
+  const FieldDecl *Field = ID->lookupFieldDeclForIvar(CGM.getContext(), Ivar);
   llvm::GlobalVariable *IvarOffsetGV = ObjCIvarOffsetVariable(ID, Ivar);
   
   // (char *) BaseValue