Really protect from infinite loop when there are objc method redeclarations.

Serialization part will come later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141950 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index bdf492b..62b4a7c 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -2168,7 +2168,7 @@
         Method->setInvalidDecl();
       } else {
         if (PrevMethod)
-          Context.setObjCMethodRedeclaration(PrevMethod, Method);
+          Method->setAsRedeclaration(PrevMethod);
         InsMap[Method->getSelector()] = Method;
         /// The following allows us to typecheck messages to "id".
         AddInstanceMethodToGlobalPool(Method);
@@ -2189,7 +2189,7 @@
         Method->setInvalidDecl();
       } else {
         if (PrevMethod)
-          Context.setObjCMethodRedeclaration(PrevMethod, Method);
+          Method->setAsRedeclaration(PrevMethod);
         ClsMap[Method->getSelector()] = Method;
         /// The following allows us to typecheck messages to "Class".
         AddFactoryMethodToGlobalPool(Method);