[cfe-commits] r76078 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/ASTContext.cpp

Steve Naroff snaroff at apple.com
Thu Jul 16 09:21:12 PDT 2009


Author: snaroff
Date: Thu Jul 16 11:21:02 2009
New Revision: 76078

URL: http://llvm.org/viewvc/llvm-project?rev=76078&view=rev
Log:
Cleanup a couple loops and improve a comment (based on feedback from Fariborz).


Modified:
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=76078&r1=76077&r2=76078&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Thu Jul 16 11:21:02 2009
@@ -1914,10 +1914,11 @@
   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 { 

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=76078&r1=76077&r2=76078&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Jul 16 11:21:02 2009
@@ -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)





More information about the cfe-commits mailing list