[PATCH] D60736: [Sema][ObjC] Don't warn about a block implicitly retaining self if the block is marked noescape

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 15 15:38:05 PDT 2019


ahatanak created this revision.
ahatanak added reviewers: rjmccall, erik.pilkington, arphaman.
ahatanak added a project: clang.
Herald added subscribers: dexonsmith, jkorous.

If the block implicitly referencing `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 `self` referenced inside a block that was nested inside a c++ lambda.

rdar://problem/25059955


Repository:
  rC Clang

https://reviews.llvm.org/D60736

Files:
  include/clang/Sema/ScopeInfo.h
  lib/Sema/Sema.cpp
  lib/Sema/SemaDeclObjC.cpp
  lib/Sema/SemaExpr.cpp
  test/SemaObjC/warn-implicit-self-in-block.m
  test/SemaObjCXX/warn-implicit-self-in-block.mm

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60736.195262.patch
Type: text/x-patch
Size: 9480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190415/faf014ec/attachment-0001.bin>


More information about the cfe-commits mailing list