When finalizing the coverage map, FunctionCoverage
only has the CodeRegion
s and counters for
the functions that went through codegen; such as public functions and “used” functions
(functions referenced by other “used” or public items). Any other functions considered unused,
or “Unreachable”, were still parsed and processed through the MIR stage, but were not
codegenned. (Note that -Clink-dead-code
can force some unused code to be codegenned, but
that flag is known to cause other errors, when combined with -C instrument-coverage
; and
-Clink-dead-code
will not generate code for unused generic functions.)
Using the expressions and counter regions collected for a single function,
generate the variable-sized payload of its corresponding __llvm_covfun
entry. The payload is returned as a vector of bytes.
Generates and exports the Coverage Map.
Construct coverage map header and the array of function records, and combine them into the
coverage map. Save the coverage map data into the LLVM IR as a static global using a
specific, well-known section and name.
Construct a function record and combine it with the function’s coverage mapping data.
Save the function record into the LLVM IR as a static global using a
specific, well-known section and name.