Skip to content

Commit 2c385ba

Browse files
authored
Rollup merge of rust-lang#131543 - Zalathar:goodbye-llvm-17, r=petrochenkov
coverage: Remove code related to LLVM 17 In-tree LLVM is 19, and the minimum external LLVM was increased to 18 in rust-lang#130487.
2 parents 8ea41b9 + 9357277 commit 2c385ba

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,20 @@ use crate::coverageinfo::ffi::CounterMappingRegion;
1414
use crate::coverageinfo::map_data::{FunctionCoverage, FunctionCoverageCollector};
1515
use crate::{coverageinfo, llvm};
1616

17-
/// Generates and exports the Coverage Map.
17+
/// Generates and exports the coverage map, which is embedded in special
18+
/// linker sections in the final binary.
1819
///
19-
/// Rust Coverage Map generation supports LLVM Coverage Mapping Format versions
20-
/// 6 and 7 (encoded as 5 and 6 respectively), as described at
21-
/// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/18.0-2024-02-13/llvm/docs/CoverageMappingFormat.rst).
22-
/// These versions are supported by the LLVM coverage tools (`llvm-profdata` and `llvm-cov`)
23-
/// distributed in the `llvm-tools-preview` rustup component.
24-
///
25-
/// Consequently, Rust's bundled version of Clang also generates Coverage Maps compliant with
26-
/// the same version. Clang's implementation of Coverage Map generation was referenced when
27-
/// implementing this Rust version, and though the format documentation is very explicit and
28-
/// detailed, some undocumented details in Clang's implementation (that may or may not be important)
29-
/// were also replicated for Rust's Coverage Map.
20+
/// Those sections are then read and understood by LLVM's `llvm-cov` tool,
21+
/// which is distributed in the `llvm-tools` rustup component.
3022
pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) {
3123
let tcx = cx.tcx;
3224

3325
// Ensure that LLVM is using a version of the coverage mapping format that
3426
// agrees with our Rust-side code. Expected versions (encoded as n-1) are:
35-
// - `CovMapVersion::Version6` (5) used by LLVM 13-17
36-
// - `CovMapVersion::Version7` (6) used by LLVM 18
27+
// - `CovMapVersion::Version7` (6) used by LLVM 18-19
3728
let covmap_version = {
3829
let llvm_covmap_version = coverageinfo::mapping_version();
39-
let expected_versions = 5..=6;
30+
let expected_versions = 6..=6;
4031
assert!(
4132
expected_versions.contains(&llvm_covmap_version),
4233
"Coverage mapping version exposed by `llvm-wrapper` is out of sync; \

compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ extern "C" void LLVMRustCoverageWriteMappingToBuffer(
183183
RustMappingRegions, NumMappingRegions)) {
184184
MappingRegions.emplace_back(
185185
fromRust(Region.Count), fromRust(Region.FalseCount),
186-
#if LLVM_VERSION_GE(18, 0) && LLVM_VERSION_LT(19, 0)
186+
#if LLVM_VERSION_LT(19, 0)
187187
coverage::CounterMappingRegion::MCDCParameters{},
188188
#endif
189189
Region.FileID, Region.ExpandedFileID, // File IDs, then region info.

0 commit comments

Comments
 (0)