about summary refs log tree commit diff
path: root/tests/codegen-llvm
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2025-05-07 07:57:01 +0000
committerMiguel Ojeda <ojeda@kernel.org>2025-08-17 16:50:23 +0200
commit1cd7080c3a7f29297675a72a157575ae12717304 (patch)
tree35d6a3c3595ce61fc4aeae69a1c9b9b85b77738b /tests/codegen-llvm
parent425a9c0a0e365c0b8c6cfd00c2ded83a73bed9a0 (diff)
downloadrust-1cd7080c3a7f29297675a72a157575ae12717304.tar.gz
rust-1cd7080c3a7f29297675a72a157575ae12717304.zip
Add -Zindirect-branch-cs-prefix (from draft PR)
Diffstat (limited to 'tests/codegen-llvm')
-rw-r--r--tests/codegen-llvm/indirect-branch-cs-prefix.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/codegen-llvm/indirect-branch-cs-prefix.rs b/tests/codegen-llvm/indirect-branch-cs-prefix.rs
new file mode 100644
index 00000000000..a00b63a4970
--- /dev/null
+++ b/tests/codegen-llvm/indirect-branch-cs-prefix.rs
@@ -0,0 +1,18 @@
+// Test that the `indirect_branch_cs_prefix` module attribute is (not) emitted when the
+// `-Zindirect-branch-cs-prefix` flag is (not) set.
+
+//@ add-core-stubs
+//@ revisions: unset set
+//@ needs-llvm-components: x86
+//@ compile-flags: --target x86_64-unknown-linux-gnu
+//@ [set] compile-flags: -Zindirect-branch-cs-prefix
+
+#![crate_type = "lib"]
+#![feature(no_core, lang_items)]
+#![no_core]
+
+#[lang = "sized"]
+trait Sized {}
+
+// unset-NOT: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1}
+// set: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1}