@@ -14,29 +14,20 @@ use crate::coverageinfo::ffi::CounterMappingRegion;
1414use crate :: coverageinfo:: map_data:: { FunctionCoverage , FunctionCoverageCollector } ;
1515use 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.
3022pub ( 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; \
0 commit comments