diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2019-04-17 23:14:44 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2019-04-17 23:14:44 +0000 |
commit | ac57af32843f0670b00eea5cf9f993241907f5ce (patch) | |
tree | 1dd7dcc16bdfc6db2e43e3c63db57466b41265ef /clang/lib/Sema/SemaDeclObjC.cpp | |
parent | 0b19f5aef94c734f45d91b20b48e98b257692792 (diff) | |
download | bcm5719-llvm-ac57af32843f0670b00eea5cf9f993241907f5ce.tar.gz bcm5719-llvm-ac57af32843f0670b00eea5cf9f993241907f5ce.zip |
[Sema][ObjC] Don't warn about an implicitly retained self if the
retaining block and all of the enclosing blocks are non-escaping.
If the block implicitly retaining self doesn't escape, there is no risk
of creating retain cycles, so clang shouldn't diagnose it and force
users to add self-> to silence the diagnostic.
Also, fix a bug where clang was failing to diagnose an implicitly
retained self inside a c++ lambda nested inside a block.
rdar://problem/25059955
Differential Revision: https://reviews.llvm.org/D60736
llvm-svn: 358624
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index d0674c641a7..430c2a2a183 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -359,6 +359,7 @@ HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) { /// ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible /// and user declared, in the method definition's AST. void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { + ImplicitlyRetainedSelfLocs.clear(); assert((getCurMethodDecl() == nullptr) && "Methodparsing confused"); ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D); |