rust/compiler/rustc_codegen_llvm/src/coverageinfo
Matthias Krüger b95232dabb
Rollup merge of #132675 - Zalathar:empty-spans, r=jieyouxu
coverage: Restrict empty-span expansion to only cover `{` and `}`

Coverage instrumentation has some tricky code for converting a coverage-relevant `Span` into a set of start/end line/byte-column coordinates that will be embedded in the CGU's coverage metadata.

A big part of this complexity is special code for handling empty spans, which are expanded into non-empty spans (if possible) because LLVM's coverage reporter does not handle empty spans well.

This PR simplifies that code by restricting it to only apply in two specific situations: when the character after the empty span is `{`, or the character before the empty span is `}`.

(As an added benefit, this means that the expanded spans no longer extend awkwardly beyond the end of a physical line, which was common under the previous implementation.)

Along the way, this PR also removes some unhelpful code for dealing with function source code spread across multiple files. Functions currently can't have coverage spans in multiple files, and if that ever changes (e.g. to properly support expansion regions) then this code will need to be completely overhauled anyway.
2024-11-10 17:43:07 +01:00
..
ffi.rs coverage: Pass a LocalFileId to CoverageSpan::from_source_region 2024-11-10 11:58:44 +11:00
llvm_cov.rs coverage: Tidy up coverage-specific FFI functions 2024-11-05 15:32:36 +11:00
map_data.rs coverage: Remove unhelpful code for handling multiple files per function 2024-11-08 20:43:08 +11:00
mapgen.rs Rollup merge of #132675 - Zalathar:empty-spans, r=jieyouxu 2024-11-10 17:43:07 +01:00
mod.rs coverage: Extract safe FFI wrapper functions to llvm_cov 2024-11-05 15:32:34 +11:00