summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-07-06 21:09:27 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-07-06 21:09:27 +0000
commitdabd1331869eacc90c21a508bf2c595ec05e0f05 (patch)
tree890e0b467dfa028c3f767312ba6bf0e440492f82 /clang/lib/Sema/SemaChecking.cpp
parenta0f4c45c38455b655bdb46737c05dae3efe38591 (diff)
downloadbcm5719-llvm-dabd1331869eacc90c21a508bf2c595ec05e0f05.tar.gz
bcm5719-llvm-dabd1331869eacc90c21a508bf2c595ec05e0f05.zip
objc-arc: warn when assigning retained object to
a 'weak' property just as we do the same for 'weak' variables. // rdar://11814185 llvm-svn: 159859
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index f3bc273d994..708fd14e499 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5233,7 +5233,7 @@ bool Sema::checkUnsafeAssigns(SourceLocation Loc,
while (ImplicitCastExpr *cast = dyn_cast<ImplicitCastExpr>(RHS)) {
if (cast->getCastKind() == CK_ARCConsumeObject) {
Diag(Loc, diag::warn_arc_retained_assign)
- << (LT == Qualifiers::OCL_ExplicitNone)
+ << (LT == Qualifiers::OCL_ExplicitNone) << 1
<< RHS->getSourceRange();
return true;
}
@@ -5290,6 +5290,16 @@ void Sema::checkUnsafeExprAssigns(SourceLocation Loc,
RHS = cast->getSubExpr();
}
}
+ else if (Attributes & ObjCPropertyDecl::OBJC_PR_weak) {
+ while (ImplicitCastExpr *cast = dyn_cast<ImplicitCastExpr>(RHS)) {
+ if (cast->getCastKind() == CK_ARCConsumeObject) {
+ Diag(Loc, diag::warn_arc_retained_assign)
+ << 0 << 0<< RHS->getSourceRange();
+ return;
+ }
+ RHS = cast->getSubExpr();
+ }
+ }
}
}
OpenPOWER on IntegriCloud