diff options
| author | Matt Weber <30441572+mweber15@users.noreply.github.com> | 2022-11-16 15:37:31 -0500 |
|---|---|---|
| committer | Matt Weber <30441572+mweber15@users.noreply.github.com> | 2024-11-06 22:12:03 -0500 |
| commit | 94669d9d47e3a594f4179a2aca9997fa1aeea7ad (patch) | |
| tree | ce1155f0a4e6e67567c627af79a31efc316e5362 /compiler/rustc_codegen_llvm/src/debuginfo | |
| parent | 5b23c38dd56b2695c5af9b801ad14f795d138b1c (diff) | |
| download | rust-94669d9d47e3a594f4179a2aca9997fa1aeea7ad.tar.gz rust-94669d9d47e3a594f4179a2aca9997fa1aeea7ad.zip | |
Add file and line metadata for closures
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 6b5f53e40bd..ebc452286b6 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1212,6 +1212,14 @@ fn build_closure_env_di_node<'ll, 'tcx>( let containing_scope = get_namespace_for_item(cx, def_id); let type_name = compute_debuginfo_type_name(cx.tcx, closure_env_type, false); + let closure_span = cx.tcx.def_span(def_id); + let (file_metadata, line_number) = if !closure_span.is_dummy() { + let loc = cx.lookup_debug_loc(closure_span.lo()); + (file_metadata(cx, &loc.file), loc.line) + } else { + (unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER) + }; + type_map::build_type_with_children( cx, type_map::stub( @@ -1219,8 +1227,8 @@ fn build_closure_env_di_node<'ll, 'tcx>( Stub::Struct, unique_type_id, &type_name, - unknown_file_metadata(cx), - UNKNOWN_LINE_NUMBER, + file_metadata, + line_number, cx.size_and_align_of(closure_env_type), Some(containing_scope), DIFlags::FlagZero, |
