Cleanup a couple loops and improve a comment (based on feedback from Fariborz).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76078 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index dd9e963..b43aadb 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -3207,8 +3207,10 @@
       // through its super class and categories.
       for (ObjCObjectPointerType::qual_iterator J = RHSOPT->qual_begin(),
            E = RHSOPT->qual_end(); J != E; ++J) {
-        if ((*J)->lookupProtocolNamed((*I)->getIdentifier()))
+        if ((*J)->lookupProtocolNamed((*I)->getIdentifier())) {
           RHSImplementsProtocol = true;
+          break;
+        }
       }
       if (!RHSImplementsProtocol)
         return false;
@@ -3252,9 +3254,11 @@
     // are incompatible.
     for (ObjCQualifiedInterfaceType::qual_iterator RHSPI = RHSP->qual_begin(),
                                                    RHSPE = RHSP->qual_end();
-         !RHSImplementsProtocol && (RHSPI != RHSPE); RHSPI++) {
-      if ((*RHSPI)->lookupProtocolNamed((*LHSPI)->getIdentifier()))
+         RHSPI != RHSPE; RHSPI++) {
+      if ((*RHSPI)->lookupProtocolNamed((*LHSPI)->getIdentifier())) {
         RHSImplementsProtocol = true;
+        break;
+      }
     }
     // FIXME: For better diagnostics, consider passing back the protocol name.
     if (!RHSImplementsProtocol)