[PATCH] D116948: [CodeGen] Treat ObjC `__unsafe_unretained` and class types as trivial when generating copy/dispose helper functions

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 12:30:52 PST 2022


rjmccall added inline comments.


================
Comment at: clang/lib/CodeGen/CGBlocks.cpp:41
+  // Reserve space now to prevent reallocation.
+  Captures.reserve(Block->getNumCaptures());
 
----------------
Does this actually work?  It's a hashtable, so I'm worried about the possibility of e.g. a bad set of collisions causing it to grow.  Even if it works today, it seems like a dangerous assumption to make.

If we're going to make `SortedCaptures` stick around, is there any way we can keep the `Capture` objects there and then have `Captures` just store pointers into it?  We'd just have to build `Captures` after the sorting was complete; I don't know if that's possible.


================
Comment at: clang/lib/CodeGen/CGBlocks.h:241
 
+  bool NoEscape : 1;
+
----------------
Please explain what this means in a comment — it's just whether the whole block itself is noescape, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116948



More information about the cfe-commits mailing list