summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/ScopeInfo.cpp2
-rw-r--r--clang/test/SemaObjC/arc-repeated-weak.mm11
2 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Sema/ScopeInfo.cpp b/clang/lib/Sema/ScopeInfo.cpp
index 7a9d917a0250..76f967d588be 100644
--- a/clang/lib/Sema/ScopeInfo.cpp
+++ b/clang/lib/Sema/ScopeInfo.cpp
@@ -115,7 +115,7 @@ FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
}
void FunctionScopeInfo::markSafeWeakUse(const Expr *E) {
- E = E->IgnoreParenImpCasts();
+ E = E->IgnoreParenCasts();
if (const PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(E)) {
markSafeWeakUse(POE->getSyntacticForm());
diff --git a/clang/test/SemaObjC/arc-repeated-weak.mm b/clang/test/SemaObjC/arc-repeated-weak.mm
index 90ba75f6efde..1c6578ef1313 100644
--- a/clang/test/SemaObjC/arc-repeated-weak.mm
+++ b/clang/test/SemaObjC/arc-repeated-weak.mm
@@ -147,6 +147,17 @@ void testBlock(Test *a) {
});
}
+void assignToStrongWithCasts(Test *a) {
+ if (condition()) {
+ Test *val = (Test *)a.weakProp; // no-warning
+ (void)val;
+ } else {
+ id val;
+ val = (Test *)a.weakProp; // no-warning
+ (void)val;
+ }
+}
+
@interface Test (Methods)
@end