aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-04-18 21:16:59 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-04-18 21:16:59 +0000
commit7c2bdcb4d30f2d370b4367664e6a11b075ce2cb3 (patch)
tree090ea30505c9686a74578d0c73f37080dac8be2a /lib/AST/ASTContext.cpp
parent877ded8532736d49b3cda8708cf0e5e9c44a760b (diff)
Fix a bug in calculation of composite type
of conditional expressions of objc pointer types where one type is the immediate base type of the other. // rdar://9296866 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129718 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index f723f2a8b7..524a7563e6 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -4963,10 +4963,10 @@ QualType ASTContext::areCommonBaseCompatible(
const ObjCObjectType *RHS = Rptr->getObjectType();
const ObjCInterfaceDecl* LDecl = LHS->getInterface();
const ObjCInterfaceDecl* RDecl = RHS->getInterface();
- if (!LDecl || !RDecl)
+ if (!LDecl || !RDecl || (LDecl == RDecl))
return QualType();
- while ((LDecl = LDecl->getSuperClass())) {
+ do {
LHS = cast<ObjCInterfaceType>(getObjCInterfaceType(LDecl));
if (canAssignObjCInterfaces(LHS, RHS)) {
llvm::SmallVector<ObjCProtocolDecl *, 8> Protocols;
@@ -4978,7 +4978,7 @@ QualType ASTContext::areCommonBaseCompatible(
Result = getObjCObjectPointerType(Result);
return Result;
}
- }
+ } while ((LDecl = LDecl->getSuperClass()));
return QualType();
}