summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2018-04-07 17:42:06 +0000
committerJohn McCall <rjmccall@apple.com>2018-04-07 17:42:06 +0000
commit48f4d4f428839d98293304bfbe83d804f2e8da2e (patch)
tree8934b83da135aeddcf3a692c34dffe9836e8baa3 /clang/lib/Sema/SemaExpr.cpp
parentad136de6449adf0c5b59c38dc22f44491809c968 (diff)
downloadbcm5719-llvm-48f4d4f428839d98293304bfbe83d804f2e8da2e.tar.gz
bcm5719-llvm-48f4d4f428839d98293304bfbe83d804f2e8da2e.zip
Allow equality comparisons between block pointers and
block-pointer-compatible ObjC object pointer types. Patch by Dustin Howett! llvm-svn: 329508
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 71cbd7f7776..b8cadaf7abb 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -10029,6 +10029,19 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
RHS = ImpCastExprToType(RHS.get(), LHSType, CK_BitCast);
return ResultTy;
}
+
+ if (!IsRelational && LHSType->isBlockPointerType() &&
+ RHSType->isBlockCompatibleObjCPointerType(Context)) {
+ LHS = ImpCastExprToType(LHS.get(), RHSType,
+ CK_BlockPointerToObjCPointerCast);
+ return ResultTy;
+ } else if (!IsRelational &&
+ LHSType->isBlockCompatibleObjCPointerType(Context) &&
+ RHSType->isBlockPointerType()) {
+ RHS = ImpCastExprToType(RHS.get(), LHSType,
+ CK_BlockPointerToObjCPointerCast);
+ return ResultTy;
+ }
}
if ((LHSType->isAnyPointerType() && RHSType->isIntegerType()) ||
(LHSType->isIntegerType() && RHSType->isAnyPointerType())) {
OpenPOWER on IntegriCloud