From: Steve Naroff Date: Thu, 16 Jul 2009 16:21:02 +0000 (+0000) Subject: Cleanup a couple loops and improve a comment (based on feedback from Fariborz). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f16756441450ed9fb39316e47d107fc2a1ef35b;p=clang 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/include/clang/AST/Type.h b/include/clang/AST/Type.h index ae85768db7..33770f4f1a 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -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 { diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index dd9e9632b2..b43aadb62e 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -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)