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

Hendrik Hübner via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 18 09:59: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>
----------------
HendrikHuebner wrote:

OGCG actually generates a bunch of attributes, something like: `call noalias noundef nonnull ptr @_Znwm(i64 noundef 4)`.

Is it okay to handle this with the wildcard syntax in the test?

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


More information about the cfe-commits mailing list