[clang] [clang-repl] Test explicit emission of dtors in runtime interface builder (NFC) (PR #89734)

Stefan Gränitz via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 03:28:57 PDT 2024


https://github.com/weliveindetail created https://github.com/llvm/llvm-project/pull/89734

This patch adds test coverage for an edge case that is supported already.

>From 085a93919d8f65419cc856fe5584c83d3eceb142 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= <stefan.graenitz at gmail.com>
Date: Tue, 23 Apr 2024 12:23:11 +0200
Subject: [PATCH] [clang-repl] Add test for explicit emission of dtors in the
 runtime interface builder

---
 clang/test/Interpreter/force-codegen-dtor.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 clang/test/Interpreter/force-codegen-dtor.cpp

diff --git a/clang/test/Interpreter/force-codegen-dtor.cpp b/clang/test/Interpreter/force-codegen-dtor.cpp
new file mode 100644
index 00000000000000..a299ea46d5eac0
--- /dev/null
+++ b/clang/test/Interpreter/force-codegen-dtor.cpp
@@ -0,0 +1,13 @@
+// UNSUPPORTED: system-aix
+
+// RUN: cat %s | clang-repl | FileCheck %s
+int *x = new int();
+template <class T> struct GuardX { T *&x; GuardX(T *&x) : x(x) {}; ~GuardX(); };
+template <class T> GuardX<T>::~GuardX() { delete x; x = nullptr; }
+
+// clang would normally defer codegen for ~GuardX()
+// Make sure that RuntimeInterfaceBuilder requests it explicitly
+(GuardX(x))
+
+// CHECK-NOT: Symbols not found
+// CHECK-NOT: _ZN6GuardXIiED2Ev



More information about the cfe-commits mailing list