about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2023-06-28 08:57:32 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2023-06-29 11:31:43 +1000
commitb4c6e19adeffad05e6039c21fdbda2097f3a2485 (patch)
tree25f79abd78f368888307cfb06a2a85a77dccfd30 /compiler/rustc_codegen_llvm/src
parenta13be655a511c215cc4d1d120d981bfe80b04eec (diff)
downloadrust-b4c6e19adeffad05e6039c21fdbda2097f3a2485.tar.gz
rust-b4c6e19adeffad05e6039c21fdbda2097f3a2485.zip
Replace a `lookup_debug_loc` call.
`lookup_debug_loc` finds a file, line, and column, which requires two
binary searches. But this call site only needs the file.

This commit replaces the call with `lookup_source_file`, which does a
single binary search.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
index 64961baf272..65cbd5edc59 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
@@ -65,10 +65,10 @@ fn make_mir_scope<'ll, 'tcx>(
         debug_context.scopes[parent]
     } else {
         // The root is the function itself.
-        let loc = cx.lookup_debug_loc(mir.span.lo());
+        let file = cx.sess().source_map().lookup_source_file(mir.span.lo());
         debug_context.scopes[scope] = DebugScope {
-            file_start_pos: loc.file.start_pos,
-            file_end_pos: loc.file.end_pos,
+            file_start_pos: file.start_pos,
+            file_end_pos: file.end_pos,
             ..debug_context.scopes[scope]
         };
         instantiated.insert(scope);