summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-06-20 20:54:42 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-06-20 20:54:42 +0000
commit4ad56863995246e115c684a305d0f3d75e4faeeb (patch)
tree8af566fac27c6c352ac1a2a5dab146d50d85ae6c /clang/lib/Sema/SemaExprObjC.cpp
parent91016396b958602b61e7665b1c841769a0845869 (diff)
downloadbcm5719-llvm-4ad56863995246e115c684a305d0f3d75e4faeeb.tar.gz
bcm5719-llvm-4ad56863995246e115c684a305d0f3d75e4faeeb.zip
objc-arc: allow explicit unbridged casts if the source of the cast is a
message sent to an objc method (or property access) // rdar://9474349 llvm-svn: 133469
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