coverage: Remove code related to LLVM 17
This commit is contained in:
parent
ce697f919d
commit
9357277de7
@ -14,29 +14,20 @@
|
|||||||
use crate::coverageinfo::map_data::{FunctionCoverage, FunctionCoverageCollector};
|
use crate::coverageinfo::map_data::{FunctionCoverage, FunctionCoverageCollector};
|
||||||
use crate::{coverageinfo, llvm};
|
use crate::{coverageinfo, llvm};
|
||||||
|
|
||||||
/// Generates and exports the Coverage Map.
|
/// Generates and exports the coverage map, which is embedded in special
|
||||||
|
/// linker sections in the final binary.
|
||||||
///
|
///
|
||||||
/// Rust Coverage Map generation supports LLVM Coverage Mapping Format versions
|
/// Those sections are then read and understood by LLVM's `llvm-cov` tool,
|
||||||
/// 6 and 7 (encoded as 5 and 6 respectively), as described at
|
/// which is distributed in the `llvm-tools` rustup component.
|
||||||
/// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/18.0-2024-02-13/llvm/docs/CoverageMappingFormat.rst).
|
|
||||||
/// These versions are supported by the LLVM coverage tools (`llvm-profdata` and `llvm-cov`)
|
|
||||||
/// distributed in the `llvm-tools-preview` rustup component.
|
|
||||||
///
|
|
||||||
/// Consequently, Rust's bundled version of Clang also generates Coverage Maps compliant with
|
|
||||||
/// the same version. Clang's implementation of Coverage Map generation was referenced when
|
|
||||||
/// implementing this Rust version, and though the format documentation is very explicit and
|
|
||||||
/// detailed, some undocumented details in Clang's implementation (that may or may not be important)
|
|
||||||
/// were also replicated for Rust's Coverage Map.
|
|
||||||
pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) {
|
pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) {
|
||||||
let tcx = cx.tcx;
|
let tcx = cx.tcx;
|
||||||
|
|
||||||
// Ensure that LLVM is using a version of the coverage mapping format that
|
// Ensure that LLVM is using a version of the coverage mapping format that
|
||||||
// agrees with our Rust-side code. Expected versions (encoded as n-1) are:
|
// agrees with our Rust-side code. Expected versions (encoded as n-1) are:
|
||||||
// - `CovMapVersion::Version6` (5) used by LLVM 13-17
|
// - `CovMapVersion::Version7` (6) used by LLVM 18-19
|
||||||
// - `CovMapVersion::Version7` (6) used by LLVM 18
|
|
||||||
let covmap_version = {
|
let covmap_version = {
|
||||||
let llvm_covmap_version = coverageinfo::mapping_version();
|
let llvm_covmap_version = coverageinfo::mapping_version();
|
||||||
let expected_versions = 5..=6;
|
let expected_versions = 6..=6;
|
||||||
assert!(
|
assert!(
|
||||||
expected_versions.contains(&llvm_covmap_version),
|
expected_versions.contains(&llvm_covmap_version),
|
||||||
"Coverage mapping version exposed by `llvm-wrapper` is out of sync; \
|
"Coverage mapping version exposed by `llvm-wrapper` is out of sync; \
|
||||||
|
@ -183,7 +183,7 @@ extern "C" void LLVMRustCoverageWriteMappingToBuffer(
|
|||||||
RustMappingRegions, NumMappingRegions)) {
|
RustMappingRegions, NumMappingRegions)) {
|
||||||
MappingRegions.emplace_back(
|
MappingRegions.emplace_back(
|
||||||
fromRust(Region.Count), fromRust(Region.FalseCount),
|
fromRust(Region.Count), fromRust(Region.FalseCount),
|
||||||
#if LLVM_VERSION_GE(18, 0) && LLVM_VERSION_LT(19, 0)
|
#if LLVM_VERSION_LT(19, 0)
|
||||||
coverage::CounterMappingRegion::MCDCParameters{},
|
coverage::CounterMappingRegion::MCDCParameters{},
|
||||||
#endif
|
#endif
|
||||||
Region.FileID, Region.ExpandedFileID, // File IDs, then region info.
|
Region.FileID, Region.ExpandedFileID, // File IDs, then region info.
|
||||||
|
Loading…
Reference in New Issue
Block a user