Keep track of objc method redeclarations in the same interface.
Avoid possible infinite loop when iterating over an ObjCMethod's redeclarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141946 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 82b5b17..bdf492b 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -2167,6 +2167,8 @@
Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
Method->setInvalidDecl();
} else {
+ if (PrevMethod)
+ Context.setObjCMethodRedeclaration(PrevMethod, Method);
InsMap[Method->getSelector()] = Method;
/// The following allows us to typecheck messages to "id".
AddInstanceMethodToGlobalPool(Method);
@@ -2186,6 +2188,8 @@
Diag(PrevMethod->getLocation(), diag::note_previous_declaration);
Method->setInvalidDecl();
} else {
+ if (PrevMethod)
+ Context.setObjCMethodRedeclaration(PrevMethod, Method);
ClsMap[Method->getSelector()] = Method;
/// The following allows us to typecheck messages to "Class".
AddFactoryMethodToGlobalPool(Method);