Revert "Rollup merge of #133418 - Zalathar:spans, r=jieyouxu"
This reverts commitadf9b5fcd1, reversing changes made toaf1ca153d4. Reverting due to <https://github.com/rust-lang/rust/issues/133606>.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
use rustc_middle::mir::coverage::{CounterId, CovTerm, ExpressionId};
|
||||
use rustc_middle::mir::coverage::{CounterId, CovTerm, ExpressionId, SourceRegion};
|
||||
|
||||
use crate::coverageinfo::mapgen::LocalFileId;
|
||||
|
||||
/// Must match the layout of `LLVMRustCounterKind`.
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
@@ -124,23 +126,37 @@ 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.
|
||||
pub(crate) file_id: u32,
|
||||
file_id: u32,
|
||||
|
||||
/// 1-based starting line of the source code span.
|
||||
pub(crate) start_line: u32,
|
||||
start_line: u32,
|
||||
/// 1-based starting column of the source code span.
|
||||
pub(crate) start_col: u32,
|
||||
start_col: u32,
|
||||
/// 1-based ending line of the source code span.
|
||||
pub(crate) end_line: u32,
|
||||
end_line: u32,
|
||||
/// 1-based ending column of the source code span. High bit must be unset.
|
||||
pub(crate) end_col: u32,
|
||||
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 }
|
||||
}
|
||||
}
|
||||
|
||||
/// Must match the layout of `LLVMRustCoverageCodeRegion`.
|
||||
#[derive(Clone, Debug)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct CodeRegion {
|
||||
pub(crate) cov_span: CoverageSpan,
|
||||
pub(crate) span: CoverageSpan,
|
||||
pub(crate) counter: Counter,
|
||||
}
|
||||
|
||||
@@ -148,7 +164,7 @@ pub(crate) struct CodeRegion {
|
||||
#[derive(Clone, Debug)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct BranchRegion {
|
||||
pub(crate) cov_span: CoverageSpan,
|
||||
pub(crate) span: CoverageSpan,
|
||||
pub(crate) true_counter: Counter,
|
||||
pub(crate) false_counter: Counter,
|
||||
}
|
||||
@@ -157,7 +173,7 @@ pub(crate) struct BranchRegion {
|
||||
#[derive(Clone, Debug)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct MCDCBranchRegion {
|
||||
pub(crate) cov_span: CoverageSpan,
|
||||
pub(crate) span: CoverageSpan,
|
||||
pub(crate) true_counter: Counter,
|
||||
pub(crate) false_counter: Counter,
|
||||
pub(crate) mcdc_branch_params: mcdc::BranchParameters,
|
||||
@@ -167,6 +183,6 @@ pub(crate) struct MCDCBranchRegion {
|
||||
#[derive(Clone, Debug)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct MCDCDecisionRegion {
|
||||
pub(crate) cov_span: CoverageSpan,
|
||||
pub(crate) span: CoverageSpan,
|
||||
pub(crate) mcdc_decision_params: mcdc::DecisionParameters,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user