diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-11-24 18:50:08 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-11-24 23:46:39 +1100 |
| commit | b9fb1a69d2fe1c146cbdf181cf9e0eaf15935799 (patch) | |
| tree | f7201981d931b6a5e099bc29ea45cc1c3b0c5de8 /compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs | |
| parent | 87fe7def1284e1c25dc358c693a9add93db5a953 (diff) | |
| download | rust-b9fb1a69d2fe1c146cbdf181cf9e0eaf15935799.tar.gz rust-b9fb1a69d2fe1c146cbdf181cf9e0eaf15935799.zip | |
coverage: Store coverage source regions as `Span` until codegen
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs index 7aa03908f0f..19d6726002c 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/ffi.rs @@ -1,6 +1,4 @@ -use rustc_middle::mir::coverage::{CounterId, CovTerm, ExpressionId, SourceRegion}; - -use crate::coverageinfo::mapgen::LocalFileId; +use rustc_middle::mir::coverage::{CounterId, CovTerm, ExpressionId}; /// Must match the layout of `LLVMRustCounterKind`. #[derive(Copy, Clone, Debug)] @@ -126,30 +124,16 @@ pub(crate) struct CoverageSpan { /// Local index into the function's local-to-global file ID table. /// The value at that index is itself an index into the coverage filename /// table in the CGU's `__llvm_covmap` section. - file_id: u32, + pub(crate) file_id: u32, /// 1-based starting line of the source code span. - start_line: u32, + pub(crate) start_line: u32, /// 1-based starting column of the source code span. - start_col: u32, + pub(crate) start_col: u32, /// 1-based ending line of the source code span. - end_line: u32, + pub(crate) end_line: u32, /// 1-based ending column of the source code span. High bit must be unset. - end_col: u32, -} - -impl CoverageSpan { - pub(crate) fn from_source_region( - local_file_id: LocalFileId, - code_region: &SourceRegion, - ) -> Self { - let file_id = local_file_id.as_u32(); - let &SourceRegion { start_line, start_col, end_line, end_col } = code_region; - // Internally, LLVM uses the high bit of `end_col` to distinguish between - // code regions and gap regions, so it can't be used by the column number. - assert!(end_col & (1u32 << 31) == 0, "high bit of `end_col` must be unset: {end_col:#X}"); - Self { file_id, start_line, start_col, end_line, end_col } - } + pub(crate) end_col: u32, } /// Must match the layout of `LLVMRustCoverageCodeRegion`. |
