Fix <rdar://problem/6329769> [sema] crash on duplication definition of interface with protocols.

As soon as we detect duplicate interfaces, discontinue further semantic checks (returning the original interface).

This is now consistent with how we handle protocols (and less error prone in general).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59541 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/check-dup-objc-decls-1.m b/test/SemaObjC/check-dup-objc-decls-1.m
index e3902bd..8536a20 100644
--- a/test/SemaObjC/check-dup-objc-decls-1.m
+++ b/test/SemaObjC/check-dup-objc-decls-1.m
@@ -26,3 +26,14 @@
 {
 	int Bar, Foo, FooBar;
 }
+
+@protocol P -im1; @end
+@protocol Q -im2; @end
+@interface A<P> @end
+@interface A<Q> @end  // expected-error {{duplicate interface declaration for class 'A'}}
+
+@protocol PP<P> @end
+@protocol PP<Q> @end  // expected-error {{duplicate protocol declaration of 'PP'}}
+
+@interface A(Cat)<P> @end
+@interface A(Cat)<Q> @end // expected-warning {{duplicate interface declaration for category 'A(Cat)'}}