[clang] [KeyInstr][Clang][NFC] Add test for array cookie store (PR #146517)
Orlando Cazalet-Hyams via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 1 05:16:40 PDT 2025
https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/146517
It doesn't need to be a Key Instruction.
(I noticed I had this test lying around on one of my branches - the extra coverage can't hurt?)
>From c2e0b5b06c7a22d0c52abfa6570959ded9e9fb1b Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Mon, 16 Jun 2025 10:43:39 +0100
Subject: [PATCH] [KeyInstr][NFC] Add test for array cookie store
It doesn't need to be a Key Instruction.
---
.../test/DebugInfo/KeyInstructions/array-cookie.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 clang/test/DebugInfo/KeyInstructions/array-cookie.cpp
diff --git a/clang/test/DebugInfo/KeyInstructions/array-cookie.cpp b/clang/test/DebugInfo/KeyInstructions/array-cookie.cpp
new file mode 100644
index 0000000000000..cfa343551d162
--- /dev/null
+++ b/clang/test/DebugInfo/KeyInstructions/array-cookie.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions %s -debug-info-kind=line-tables-only -gno-column-info -emit-llvm -o - \
+// RUN: | FileCheck %s
+
+// Array cookie store doesn't need to be a key instruction.
+
+struct a { char c; ~a(); };
+void b() { new a[2]; }
+
+// CHECK: %call = call {{.*}}ptr @_Znam(i64 noundef 10)
+// CHECK-NEXT: store i64 2, ptr %call, align 8, !dbg [[DBG:!.*]]
+
+// CHECK: [[DBG]] = !DILocation(line: 7, scope: ![[#]])
More information about the cfe-commits
mailing list