Skip to content

Commit b4c6e19

Browse files
committed
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.
1 parent a13be65 commit b4c6e19

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ fn make_mir_scope<'ll, 'tcx>(
6565
debug_context.scopes[parent]
6666
} else {
6767
// The root is the function itself.
68-
let loc = cx.lookup_debug_loc(mir.span.lo());
68+
let file = cx.sess().source_map().lookup_source_file(mir.span.lo());
6969
debug_context.scopes[scope] = DebugScope {
70-
file_start_pos: loc.file.start_pos,
71-
file_end_pos: loc.file.end_pos,
70+
file_start_pos: file.start_pos,
71+
file_end_pos: file.end_pos,
7272
..debug_context.scopes[scope]
7373
};
7474
instantiated.insert(scope);

0 commit comments

Comments
 (0)