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

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 15 17:01:57 PDT 2019


erik.pilkington added a comment.

Akira and I were just talking about an alternative approach to this: Keep a vector of pairs of BlockDecls and SourceLocations in the enclosing method's FunctionScopeInfo, and emit any unsuppressed  diagnostics when popping the method. This would avoid having to traverse all the blocks in methods in ARC mode, at the cost of a small amount of memory.



================
Comment at: lib/Sema/Sema.cpp:1682-1687
+  void VisitBlockDecl(const BlockDecl *BD) {
+    bool OldVisitingEscapingBlock = VisitingEscapingBlock;
+    VisitingEscapingBlock = VisitingEscapingBlock || !BD->doesNotEscape();
+    Visit(BD->getBody());
+    VisitingEscapingBlock = OldVisitingEscapingBlock;
+  }
----------------
Maybe call this "diagnoseBlockDecl" or something so it doesn't sounds like a CRTP-overridden method.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60736/new/

https://reviews.llvm.org/D60736





More information about the cfe-commits mailing list