[clang] [CIR] Add builtin operator new/delete (PR #168578)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 18 11:30:18 PST 2025


================
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --check-prefix=LLVM --input-file=%t-cir.ll %s
+// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --check-prefix=OGCG --input-file=%t.ll %s
+
+
+void test_builtins_basic() {
+  __builtin_operator_delete(__builtin_operator_new(4));
+  // CIR-LABEL: test_builtins_basic
+  // CIR: [[P:%.*]] = cir.call @_Znwm({{%.*}}) : (!u64i) -> !cir.ptr<!void>
----------------
xlauko wrote:

Where are these set? And why is it not set in CIR pipeline?
I would prefer not to ignroe them in this case as CIRGen is creating the call in this case?

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


More information about the cfe-commits mailing list