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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 23 03:29:27 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Stefan Gränitz (weliveindetail)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/89734.diff


1 Files Affected:

- (added) clang/test/Interpreter/force-codegen-dtor.cpp (+13) 


``````````diff
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

``````````

</details>


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


More information about the cfe-commits mailing list