Skip to content

Commit

Permalink
Replace a lookup_debug_loc call.
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
nnethercote committed Jun 29, 2023
1 parent a13be65 commit b4c6e19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b4c6e19

Please sign in to comment.