[PATCH] D49718: [CodeGen][ObjC] Make block copy/dispose helper function exception-safe.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 24 00:30:15 PDT 2018


rjmccall added a comment.

In https://reviews.llvm.org/D49718#1173038, @ahatanak wrote:

> Note that in order to destruct C++ objects, I'm using pushDestroy which pushes a NormalCleanup when exception handling isn't enabled. This is different from PushDestructorCleanup which always pushes a NormalAndEHCleanup, but I think using pushDestroy is more correct since I don't think we need to do a cleanup on the EH path when exception isn't enabled.


I don't think it makes any difference because we shouldn't be emitting cleanup paths when exceptions are disabled.  I don't think there's an intended difference in semantics between those two destructor-cleanup paths, at least.



================
Comment at: lib/CodeGen/CGBlocks.cpp:1603
+  };
+}
+
----------------
There's already a `CallBlockRelease` cleanup that can presumably be unified with this.


================
Comment at: lib/CodeGen/CGBlocks.cpp:1905
+    case BlockCaptureEntityKind::None:
+      llvm_unreachable("unexpected BlockCaptureEntityKind");
     }
----------------
These two switches differ only in (1) what kind of cleanup they push and (2) a small optimization that can easily be conditionalized by the request to push an EH-only cleanup.


Repository:
  rC Clang

https://reviews.llvm.org/D49718





More information about the cfe-commits mailing list