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.
This commit is contained in:
Nicholas Nethercote 2023-06-28 08:57:32 +10:00
parent a13be655a5
commit b4c6e19ade

View File

@ -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);