Skip to content

Commit e6a5ff2

Browse files
authored
Rollup merge of rust-lang#114760 - DianQK:update-test-for-type-decl-disubprogram, r=cuviper
DebugInfo: Updates test cases that add method declarations. We've investigated one reason why debugging information often goes wrong at https://reviews.llvm.org/D152095. > LLVM can't handle IR where subprogram definitions are nested within DICompositeType when doing LTO builds, because there's no good way to cross the CU boundary to insert a nested DISubprogram definition in one CU into a type defined in another CU. In rust-lang#111167, we added a declaration for the DISubprogram for the method. This PR completes this test case. stream history: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm/topic/Dwarf.20CUs/near/384269475.
2 parents 378c2fd + 6f5b4e3 commit e6a5ff2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/codegen/method-declaration.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// compile-flags: -g -Cno-prepopulate-passes
2+
3+
// Verify that we added a declaration for a method.
4+
5+
// CHECK: define{{.*}}@method{{.*}} !dbg ![[METHOD_DEF_DBG:[0-9]+]]
6+
// CHECK: define{{.*}}@function{{.*}} !dbg ![[FUNC_DEF_DBG:[0-9]+]]
7+
8+
#![crate_type = "lib"]
9+
10+
// CHECK-DAG: ![[FOO_DBG:[0-9]+]] = !DICompositeType(tag: {{.*}} name: "Foo", {{.*}} identifier:
11+
pub struct Foo;
12+
13+
impl Foo {
14+
// CHECK-DAG: ![[METHOD_DEF_DBG]] = distinct !DISubprogram(name: "method"{{.*}}, scope: ![[FOO_DBG]]{{.*}}DISPFlagDefinition{{.*}}, declaration: ![[METHOD_DECL_DBG:[0-9]+]]
15+
// CHECK-DAG: ![[METHOD_DECL_DBG]] = !DISubprogram(name: "method"{{.*}}, scope: ![[FOO_DBG]]
16+
#[no_mangle]
17+
pub fn method() {}
18+
}
19+
20+
// CHECK: ![[FUNC_DEF_DBG]] = distinct !DISubprogram(name: "function"
21+
// CHECK-NOT: declaration
22+
// CHECK-SAME: DISPFlagDefinition
23+
// CHECK-NOT: declaration
24+
// CHECK-SAME: )
25+
#[no_mangle]
26+
pub fn function() {}

0 commit comments

Comments
 (0)