[PATCH] D49303: [CodeGen][ObjC] Treat non-escaping blocks as global blocks to make copy/dispose a no-op

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 19 12:24:41 PDT 2018


rjmccall added inline comments.


================
Comment at: docs/Block-ABI-Apple.rst:64
     enum {
+        BLOCK_IS_NOESCAPE      =  (1 << 23),
         BLOCK_HAS_COPY_DISPOSE =  (1 << 25),
----------------
Something happened to my older comments here, but please document the meaning of this flag.  Specifically, it is set on blocks that do have captures (and thus are not true global blocks) but which are known not to escape for various other reasons.  Please include the fact that it implies `BLOCK_IS_GLOBAL` and explain why.


================
Comment at: lib/CodeGen/CGBlocks.h:283
+  // Indicates whether the block needs a custom copy or dispose function.
+  bool needsCopyDispose() const {
+    return NeedsCopyDispose && !Block->doesNotEscape();
----------------
Please rename this to `needsCopyDisposeHelpers()` to make it clearer that it's specifically about the need for the functions.


Repository:
  rC Clang

https://reviews.llvm.org/D49303





More information about the cfe-commits mailing list