Skip to main content

Module mapgen

Module mapgen 

Source

Re-exportsΒ§

use std::assert_matches; πŸ”’
use itertools::Itertools; πŸ”’
use rustc_abi::Align; πŸ”’
use rustc_codegen_ssa::traits::BaseTypeCodegenMethods; πŸ”’
use rustc_codegen_ssa::traits::ConstCodegenMethods; πŸ”’
use rustc_data_structures::fx::FxIndexMap; πŸ”’
use rustc_middle::ty::TyCtxt; πŸ”’
use rustc_span::FileName; πŸ”’
use rustc_span::RemapPathScopeComponents; πŸ”’
use rustc_span::SourceFile; πŸ”’
use rustc_span::StableSourceFileId; πŸ”’
use tracing::debug; πŸ”’
use crate::common::CodegenCx; πŸ”’
use crate::coverageinfo::llvm_cov; πŸ”’
use crate::coverageinfo::mapgen::covfun::prepare_covfun_record; πŸ”’
use crate::llvm; πŸ”’
use crate::macros::TryFromU32; πŸ”’

ModulesΒ§

covfun πŸ”’
For each function that was instrumented for coverage, we need to embed its corresponding coverage mapping metadata inside the __llvm_covfun linker section of the final binary.
spans πŸ”’
unused πŸ”’

StructsΒ§

GlobalFileId πŸ”’
An index into the CGU’s overall list of file paths. The underlying paths will be embedded in the __llvm_covmap linker section.
GlobalFileTable πŸ”’
Maps β€œglobal” (per-CGU) file ID numbers to their underlying source file paths.
LocalFileId πŸ”’
An index into a function’s list of global file IDs. That underlying list of local-to-global mappings will be embedded in the function’s record in the __llvm_covfun linker section.

EnumsΒ§

CovmapVersion πŸ”’
Version number that will be included the __llvm_covmap section header. Corresponds to LLVM’s llvm::coverage::CovMapVersion (in CoverageMapping.h), or at least the subset that we know and care about.

FunctionsΒ§

emit_covmap_record πŸ”’
Generates and emits the covmap record for this CGU, which mostly consists of a header and a list of filenames. The record is emitted as a global variable in the __llvm_covmap section.
finalize πŸ”’
Generates and exports the coverage map, which is embedded in special linker sections in the final binary.