]> granicus.if.org Git - clang/commitdiff
Cleanup a couple loops and improve a comment (based on feedback from Fariborz).
authorSteve Naroff <snaroff@apple.com>
Thu, 16 Jul 2009 16:21:02 +0000 (16:21 +0000)
committerSteve Naroff <snaroff@apple.com>
Thu, 16 Jul 2009 16:21:02 +0000 (16:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76078 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
lib/AST/ASTContext.cpp

index ae85768db73601f039386825d3fcf89fc52943b0..33770f4f1a1a9c3371443ec8567285b3be27e4d4 100644 (file)
@@ -1914,10 +1914,11 @@ class ObjCObjectPointerType : public Type, public llvm::FoldingSetNode {
   friend class ASTContext;  // ASTContext creates these.
   
 public:
-  // Get the pointee type. Pointee will either be a built-in type (for 'id' and
-  // 'Class') or will be an interface type (for user-defined types).
-  // Note: Pointee can be a TypedefType whose canonical type is an interface. 
-  // Example: typedef NSObject T; T *var;
+  // Get the pointee type. Pointee will either be:
+  // - a built-in type (for 'id' and 'Class').
+  // - an interface type (for user-defined types).
+  // - a TypedefType whose canonical type is an interface (as in 'T' below).
+  //   For example: typedef NSObject T; T *var;
   QualType getPointeeType() const { return PointeeType; }
 
   const ObjCInterfaceType *getInterfaceType() const { 
index dd9e9632b240b850a2152f77d0a03127ecfe8fcb..b43aadb62e4ac7188762858bfa032aa6c3fe2fa5 100644 (file)
@@ -3207,8 +3207,10 @@ bool ASTContext::canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT,
       // 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 @@ bool ASTContext::canAssignObjCInterfaces(const ObjCInterfaceType *LHS,
     // 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)