Skip to content

[KeyInstr][Clang][NFC] Add test for array cookie store #146517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OCHyams
Copy link
Contributor

@OCHyams OCHyams commented Jul 1, 2025

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?)

It doesn't need to be a Key Instruction.
@OCHyams OCHyams requested review from jmorse and SLTozer July 1, 2025 12:16
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 1, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 1, 2025

@llvm/pr-subscribers-clang

Author: Orlando Cazalet-Hyams (OCHyams)

Changes

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?)


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

1 Files Affected:

  • (added) clang/test/DebugInfo/KeyInstructions/array-cookie.cpp (+12)
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: ![[#]])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants