@@ -14,29 +14,20 @@ use crate::coverageinfo::ffi::CounterMappingRegion;
14
14
use crate :: coverageinfo:: map_data:: { FunctionCoverage , FunctionCoverageCollector } ;
15
15
use crate :: { coverageinfo, llvm} ;
16
16
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.
18
19
///
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.
30
22
pub ( crate ) fn finalize ( cx : & CodegenCx < ' _ , ' _ > ) {
31
23
let tcx = cx. tcx ;
32
24
33
25
// Ensure that LLVM is using a version of the coverage mapping format that
34
26
// 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
37
28
let covmap_version = {
38
29
let llvm_covmap_version = coverageinfo:: mapping_version ( ) ;
39
- let expected_versions = 5 ..=6 ;
30
+ let expected_versions = 6 ..=6 ;
40
31
assert ! (
41
32
expected_versions. contains( & llvm_covmap_version) ,
42
33
"Coverage mapping version exposed by `llvm-wrapper` is out of sync; \
0 commit comments