1
Fork 0
rust/compiler/rustc_codegen_llvm/src
Wesley Wiser 1a0278e1d1 Work around missing code coverage data causing llvm-cov failures
If we do not add code coverage instrumentation to the `Body` of a
function, then when we go to generate the function record for it, we
won't write any data and this later causes llvm-cov to fail when
processing data for the entire coverage report.

I've identified two main cases where we do not currently add code
coverage instrumentation to the `Body` of a function:

  1. If the function has a single `BasicBlock` and it ends with a
     `TerminatorKind::Unreachable`.

  2. If the function is created using a proc macro of some kind.

For case 1, this typically not important as this most often occurs as
the result of function definitions that take or return uninhabited
types. These kinds of functions, by definition, cannot even be called so
they logically should not be counted in code coverage statistics.

For case 2, I haven't looked into this very much but I've noticed while
testing this patch that (other than functions which are covered by case
1) the skipped function coverage debug message is occasionally triggered
in large crate graphs by functions generated from a proc macro. This may
have something to do with weird spans being generated by the proc macro
but this is just a guess.

I think it's reasonable to land this change since currently, we fail to
generate *any* results from llvm-cov when a function has no coverage
instrumentation applied to it. With this change, we get coverage data
for all functions other than the two cases discussed above.
2022-01-21 19:39:18 +00:00
..
back Rollup merge of #90782 - ricobbe:binutils-dlltool, r=michaelwoerister 2022-01-18 22:00:42 +01:00
coverageinfo Work around missing code coverage data causing llvm-cov failures 2022-01-21 19:39:18 +00:00
debuginfo rustc_codegen_llvm: Remove (almost) unused span parameter from many functions in metadata.rs. 2022-01-17 16:43:23 +01:00
llvm Rollup merge of #92877 - Amanieu:remove_llvm_nounwind, r=Mark-Simulacrum 2022-01-17 20:07:07 +01:00
abi.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
allocator.rs Include debug info for the allocator shim 2021-08-31 15:24:20 -07:00
asm.rs Use Symbol for target features in asm handling 2022-01-17 18:06:27 +01:00
attributes.rs Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
base.rs Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk 2021-12-19 09:31:37 +00:00
builder.rs Update compiler/rustc_codegen_llvm/src/builder.rs 2022-01-17 22:29:12 -05:00
callee.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
common.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
consts.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
context.rs Auto merge of #88354 - Jmc18134:hint-space-pauth-opt, r=nagisa 2021-12-29 22:35:11 +00:00
declare.rs Auto merge of #88354 - Jmc18134:hint-space-pauth-opt, r=nagisa 2021-12-29 22:35:11 +00:00
intrinsic.rs Rollup merge of #92425 - calebzulawski:simd-cast, r=workingjubilee 2022-01-18 22:00:45 +01:00
lib.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
llvm_util.rs Auto merge of #92419 - erikdesjardins:coldland, r=nagisa 2022-01-01 13:28:13 +00:00
mono_item.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
type_.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
type_of.rs Store a Symbol instead of an Ident in VariantDef/FieldDef 2022-01-11 10:16:22 -05:00
va_arg.rs Remove in_band_lifetimes from rustc_codegen_llvm 2021-12-16 14:43:32 -05:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00