summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/Type.h9
-rw-r--r--clang/lib/AST/ASTContext.cpp10
2 files changed, 12 insertions, 7 deletions
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index ae85768db73..33770f4f1a1 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/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/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index dd9e9632b24..b43aadb62e4 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud