summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 5aff7347a6d..9c9332a5f0e 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -1550,6 +1550,12 @@ namespace {
};
}
+bool
+Sema::ValidObjCARCNoBridgeCastExpr(const Expr *Exp) {
+ Exp = Exp->IgnoreParenImpCasts();
+ return isa<ObjCMessageExpr>(Exp) || isa<ObjCPropertyRefExpr>(Exp);
+}
+
void
Sema::CheckObjCARCConversion(SourceRange castRange, QualType castType,
Expr *castExpr, CheckedConversionKind CCK) {
@@ -1606,6 +1612,10 @@ Sema::CheckObjCARCConversion(SourceRange castRange, QualType castType,
if (castType->isObjCARCBridgableType() &&
castExprType->isCARCBridgableType()) {
+ // explicit unbridged casts are allowed if the source of the cast is a
+ // message sent to an objc method (or property access)
+ if (ValidObjCARCNoBridgeCastExpr(castExpr))
+ return;
Diag(loc, diag::err_arc_cast_requires_bridge)
<< 2
<< castExprType
OpenPOWER on IntegriCloud