about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2024-03-30 05:23:38 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2024-03-30 05:23:38 +0000
commit28521fd2eb40339a20e10c124e60b5efbc31e17b (patch)
tree90d2cf40dac38eaa763ff4df5c514b0f86b4b40e /tests/codegen
parentfee9a8eab8f1ae85135f2de7bf8bee815e364665 (diff)
parent69fa40cb48384fad7930dce2d9a20d18fe4d1b51 (diff)
downloadrust-28521fd2eb40339a20e10c124e60b5efbc31e17b.tar.gz
rust-28521fd2eb40339a20e10c124e60b5efbc31e17b.zip
Merge from rustc
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs22
-rw-r--r--tests/codegen/vec_pop_push_noop.rs6
2 files changed, 25 insertions, 3 deletions
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs
new file mode 100644
index 00000000000..671db563dde
--- /dev/null
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-method-secondary-typeid.rs
@@ -0,0 +1,22 @@
+// Verifies that a secondary type metadata identifier is assigned to methods with their concrete
+// self so they can be used as function pointers.
+//
+//@ needs-sanitizer-cfi
+//@ compile-flags: -Clto -Cno-prepopulate-passes -Copt-level=0 -Zsanitizer=cfi -Ctarget-feature=-crt-static
+
+#![crate_type="lib"]
+
+trait Trait1 {
+    fn foo(&self);
+}
+
+struct Type1;
+
+impl Trait1 for Type1 {
+    fn foo(&self) {}
+    // CHECK: define{{.*}}3foo{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}}
+}
+
+
+// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu3dynIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}6Trait1u6regionEEE"}
+// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtC{{[[:print:]]+}}_{{[[:print:]]+}}5Type1EE"}
diff --git a/tests/codegen/vec_pop_push_noop.rs b/tests/codegen/vec_pop_push_noop.rs
index 83765d10854..4d76c24a9d9 100644
--- a/tests/codegen/vec_pop_push_noop.rs
+++ b/tests/codegen/vec_pop_push_noop.rs
@@ -5,10 +5,10 @@
 #[no_mangle]
 // CHECK-LABEL: @noop(
 pub fn noop(v: &mut Vec<u8>) {
-    // CHECK-NOT: reserve_for_push
+    // CHECK-NOT: grow_one
     // CHECK-NOT: call
     // CHECK: tail call void @llvm.assume
-    // CHECK-NOT: reserve_for_push
+    // CHECK-NOT: grow_one
     // CHECK-NOT: call
     // CHECK: ret
     if let Some(x) = v.pop() {
@@ -19,6 +19,6 @@ pub fn noop(v: &mut Vec<u8>) {
 #[no_mangle]
 // CHECK-LABEL: @push_byte(
 pub fn push_byte(v: &mut Vec<u8>) {
-    // CHECK: call {{.*}}reserve_for_push
+    // CHECK: call {{.*}}grow_one
     v.push(3);
 }