[clang] [clang][bytecode][NFC] Check hasTrivialDtor() in RunDestructors (PR #155381)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 26 02:08:53 PDT 2025
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/155381
We do this when calling Free() on dynamically allocated memory.
>From 2e16dde1cefb26576eff27f9337a8b2135e35bbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Tue, 26 Aug 2025 11:07:35 +0200
Subject: [PATCH] [clang][bytecode][NFC] Check hasTrivialDtor() in
RunDestructors
We do this when calling Free() on dynamically allocated memory.
---
clang/lib/AST/ByteCode/Interp.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index d4525c8288c68..24a6158fa9973 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1229,6 +1229,9 @@ static bool RunDestructors(InterpState &S, CodePtr OpPC, const Block *B) {
assert(Desc->isRecord() || Desc->isCompositeArray());
+ if (Desc->hasTrivialDtor())
+ return true;
+
if (Desc->isCompositeArray()) {
unsigned N = Desc->getNumElems();
if (N == 0)
More information about the cfe-commits
mailing list