Skip to content

Commit 7c73081

Browse files
committed
Split metadata testing into multiple files
This helps with the fact that the order in which debuginfo is emitted differs between platforms, and is probably not guaranteed to be stable in general.
1 parent aabddca commit 7c73081

5 files changed

+73
-45
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and
2+
// generators.
3+
//
4+
// compile-flags: -C debuginfo=2
5+
#![crate_type = "lib"]
6+
#![feature(generators)]
7+
8+
// CHECK: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-closure-generator.rs{{".*}})
9+
10+
pub fn foo() {
11+
// CHECK: !DICompositeType({{.*"[{]}}closure_env#0{{[}]".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
12+
let closure = |x| x;
13+
closure(0);
14+
15+
// CHECK: !DICompositeType({{.*"[{]}}generator_env#1{{[}]".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
16+
let generator = || yield 1;
17+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This test verifies the accuracy of emitted file and line debuginfo metadata for C++-like
2+
// enumerations.
3+
//
4+
// compile-flags: -C debuginfo=2
5+
#![crate_type = "lib"]
6+
7+
// The use of CHECK-DAG here is because the C++-like enum is emitted before the `DIFile` node
8+
9+
// CHECK-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-cpp-like-enum.rs{{".*}})
10+
11+
// CHECK-DAG: !DICompositeType({{.*"}}MyCppLikeEnum{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
12+
#[repr(C)]
13+
pub enum MyCppLikeEnum {
14+
One,
15+
}
16+
17+
pub fn foo(_: MyCppLikeEnum) {}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This test verifies the accuracy of emitted file and line debuginfo metadata for native
2+
// enumerations.
3+
//
4+
// compile-flags: -C debuginfo=2
5+
#![crate_type = "lib"]
6+
7+
// CHECK: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-native-enum.rs{{".*}})
8+
9+
// CHECK: !DICompositeType({{.*"}}MyNativeEnum{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 2]],
10+
// CHECK: !DICompositeType({{.*}}DW_TAG_variant_part{{.*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
11+
pub enum MyNativeEnum {
12+
// CHECK: !DIDerivedType({{.*"}}One{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
13+
One,
14+
}
15+
16+
pub fn foo(_: MyNativeEnum) {}
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// This test verifies the accuracy of emitted file and line debuginfo metadata for structs and
2+
// unions.
3+
//
4+
// compile-flags: -C debuginfo=2
5+
#![crate_type = "lib"]
6+
7+
// CHECK: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}/codegen/issue-98678-struct-union.rs{{".*}})
8+
9+
// CHECK: !DICompositeType({{.*"}}MyType{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
10+
pub struct MyType {
11+
// CHECK: !DIDerivedType({{.*"}}i{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
12+
i: i32,
13+
}
14+
15+
// CHECK: !DICompositeType({{.*"}}MyUnion{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
16+
pub union MyUnion {
17+
// CHECK: !DIDerivedType({{.*"}}i{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
18+
i: i32,
19+
// CHECK: !DIDerivedType({{.*"}}f{{".*}}file: ![[#FILE]]{{.*}}line: [[# @LINE + 1]],
20+
f: f32,
21+
}
22+
23+
pub fn foo(_: MyType, _: MyUnion) {}

tests/codegen/issue-98678.rs

-45
This file was deleted.

0 commit comments

Comments
 (0)