From 4a67508685abee7b8d3ebbca6b1144d2c7ead211 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Wed, 3 Oct 2012 17:55:29 +0000 Subject: objective-C arc: Warn under arc about a use of an ivar inside a block that doesn't have a 'self' as this implicitly captures 'self' and could create retain cycles. Provide fixit. // rdar://11194874 llvm-svn: 165133 --- clang/lib/Sema/SemaExpr.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Sema/SemaExpr.cpp') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 75bc8658c65..bbae55b5980 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -2008,6 +2008,9 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, if (Level != DiagnosticsEngine::Ignored) getCurFunction()->recordUseOfWeak(Result); } + if (CurContext->isClosure()) + Diag(Loc, diag::warn_implicitly_retains_self) + << FixItHint::CreateInsertion(Loc, "self->"); } return Owned(Result); -- cgit v1.2.3