@@ -18,11 +18,11 @@ use rustc_span::Symbol;
18
18
19
19
/// Generates and exports the Coverage Map.
20
20
///
21
- /// Rust Coverage Map generation supports LLVM Coverage Mapping Format version
22
- /// 6 (zero-based encoded as 5), as defined at
23
- /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/13 .0-2021-09-30 /llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format ).
21
+ /// Rust Coverage Map generation supports LLVM Coverage Mapping Format versions
22
+ /// 6 and 7 ( encoded as 5 and 6 respectively ), as described at
23
+ /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/18 .0-2024-02-13 /llvm/docs/CoverageMappingFormat.rst).
24
24
/// These versions are supported by the LLVM coverage tools (`llvm-profdata` and `llvm-cov`)
25
- /// bundled with Rust's fork of LLVM .
25
+ /// distributed in the `llvm-tools-preview` rustup component .
26
26
///
27
27
/// Consequently, Rust's bundled version of Clang also generates Coverage Maps compliant with
28
28
/// the same version. Clang's implementation of Coverage Map generation was referenced when
@@ -32,10 +32,17 @@ use rustc_span::Symbol;
32
32
pub fn finalize ( cx : & CodegenCx < ' _ , ' _ > ) {
33
33
let tcx = cx. tcx ;
34
34
35
- // Ensure the installed version of LLVM supports Coverage Map Version 6
36
- // (encoded as a zero-based value: 5), which was introduced with LLVM 13.
35
+ // Ensure that LLVM is using a version of the coverage mapping format that
36
+ // we know about. Supported versions (encoded as n-1) are:
37
+ // - `CovMapVersion::Version6` (5) used by LLVM 13-17
38
+ // - `CovMapVersion::Version7` (6) used by LLVM 18
37
39
let version = coverageinfo:: mapping_version ( ) ;
38
- assert_eq ! ( version, 5 , "The `CoverageMappingVersion` exposed by `llvm-wrapper` is out of sync" ) ;
40
+ let expected_versions = 5 ..=6 ;
41
+ assert ! (
42
+ expected_versions. contains( & version) ,
43
+ "Coverage mapping version exposed by `llvm-wrapper` is out of sync; \
44
+ expected {expected_versions:?} but was {version}"
45
+ ) ;
39
46
40
47
debug ! ( "Generating coverage map for CodegenUnit: `{}`" , cx. codegen_unit. name( ) ) ;
41
48
0 commit comments