When forming a cycle in objc's inheritance hierarchy,
diagnose it properly and don't throw clang into an
infinit loop. // rdar://9653341


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133773 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index b54e242..3bbe421 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -491,10 +491,13 @@
         if (!SuperClassDecl)
           Diag(SuperLoc, diag::err_undef_superclass)
             << SuperName << ClassName << SourceRange(AtInterfaceLoc, ClassLoc);
-        else if (SuperClassDecl->isForwardDecl())
-          Diag(SuperLoc, diag::err_undef_superclass)
+        else if (SuperClassDecl->isForwardDecl()) {
+          Diag(SuperLoc, diag::err_forward_superclass)
             << SuperClassDecl->getDeclName() << ClassName
             << SourceRange(AtInterfaceLoc, ClassLoc);
+          Diag(SuperClassDecl->getLocation(), diag::note_forward_class);
+          SuperClassDecl = 0;
+        }
       }
       IDecl->setSuperClass(SuperClassDecl);
       IDecl->setSuperClassLoc(SuperLoc);