1
Fork 0

coverage: Rename CodeRegion to SourceRegion

LLVM uses the word "code" to refer to a particular kind of coverage mapping.
This unrelated usage of the word is confusing, and makes it harder to introduce
types whose names correspond to the LLVM classification of coverage kinds.
This commit is contained in:
Zalathar 2024-08-28 18:46:49 +10:00
parent 5e162a8f48
commit 46e1b5b6dd
5 changed files with 35 additions and 34 deletions

View file

@ -163,7 +163,7 @@ impl Debug for CoverageKind {
#[derive(Clone, TyEncodable, TyDecodable, Hash, HashStable, PartialEq, Eq, PartialOrd, Ord)]
#[derive(TypeFoldable, TypeVisitable)]
pub struct CodeRegion {
pub struct SourceRegion {
pub file_name: Symbol,
pub start_line: u32,
pub start_col: u32,
@ -171,7 +171,7 @@ pub struct CodeRegion {
pub end_col: u32,
}
impl Debug for CodeRegion {
impl Debug for SourceRegion {
fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result {
write!(
fmt,
@ -242,7 +242,7 @@ impl MappingKind {
#[derive(TyEncodable, TyDecodable, Hash, HashStable, TypeFoldable, TypeVisitable)]
pub struct Mapping {
pub kind: MappingKind,
pub code_region: CodeRegion,
pub source_region: SourceRegion,
}
/// Stores per-function coverage information attached to a `mir::Body`,

View file

@ -547,8 +547,8 @@ fn write_function_coverage_info(
for (id, expression) in expressions.iter_enumerated() {
writeln!(w, "{INDENT}coverage {id:?} => {expression:?};")?;
}
for coverage::Mapping { kind, code_region } in mappings {
writeln!(w, "{INDENT}coverage {kind:?} => {code_region:?};")?;
for coverage::Mapping { kind, source_region } in mappings {
writeln!(w, "{INDENT}coverage {kind:?} => {source_region:?};")?;
}
writeln!(w)?;