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

llvm-svn: 76078
This commit is contained in:
Steve Naroff 2009-07-16 16:21:02 +00:00
parent 1511f701e7
commit fac5bc9264
2 changed files with 12 additions and 7 deletions

View 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 {

View 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)