[clang] [clang][bytecode] Split up `InterpState::dealllocate()` (PR #239185)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 22:49:37 PST 2026


================
@@ -93,21 +93,14 @@ void InterpState::cleanup() {
 
 const Frame *InterpState::getCurrentFrame() { return Current; }
 
-void InterpState::deallocate(Block *B) {
+void InterpState::deallocateWithPointers(Block *B) {
   assert(B);
+  assert(B->hasPointers());
   assert(!B->isDynamic());
   assert(!B->isGlobal());
   assert(!B->isDead());
-
-  // The block might have a pointer saved in a field in its data
-  // that points to the block itself. We call the dtor first,
-  // which will destroy all the data but leave InlineDescriptors
-  // intact. If the block THEN still has pointers, we create a
-  // DeadBlock for it.
-  if (B->IsInitialized)
-    B->invokeDtor();
-
   assert(!B->isInitialized());
+
   if (B->hasPointers()) {
----------------
ojhunt wrote:

We only call deallocateWithPointers after a ->hasPointers() check, and we assert on entry - I feel like this should be removed and just accept the formatting difference now?

https://github.com/llvm/llvm-project/pull/239185


More information about the cfe-commits mailing list