]> git.lizzy.rs Git - rust.git/commit
Rust function-level coverage now works on external crates
authorRich Kadel <richkadel@google.com>
Thu, 30 Jul 2020 19:25:39 +0000 (12:25 -0700)
committerRich Kadel <richkadel@google.com>
Thu, 30 Jul 2020 19:25:39 +0000 (12:25 -0700)
commit34b26d6a77c45776cbbef182b4c1b0b96ac326fe
tree043861595ab0039a459b1d42e651ea83714c4db4
parent6b09c37ddc240e25748e53d7a8f81f252def6dee
Rust function-level coverage now works on external crates

Fixed a known issue in the coverage map where some regions had
nonsensical source code locations. External crate functions are already
included in their own coverage maps, per library, and don't need to also
be added to the importing crate's coverage map. (In fact, their source
start and end byte positions are not relevant to the importing crate's
SourceMap.)

The fix was to simply skip trying to add imported coverage info to the
coverage map if the instrumented function is not "local".

The injected counters are still relevant, however, and the LLVM
`instrprof.increment` intrinsic call parameters will map those counters
to the external crates' coverage maps, when generating runtime coverage
data.
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_ssa/coverageinfo/map.rs