diff options
| author | bors <bors@rust-lang.org> | 2020-07-19 07:25:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-19 07:25:18 +0000 |
| commit | 47ea6d90b073ab977cf072e2f5f46d63de532cc6 (patch) | |
| tree | d408537bbf5d8d3063d19914f6e30efe02c74681 /src/libcore | |
| parent | 0701419e96d94e5493c7ebfcecb66511ab0aa778 (diff) | |
| parent | a6f8b8a2116f0ea7e31d572d3120508678ed8079 (diff) | |
| download | rust-47ea6d90b073ab977cf072e2f5f46d63de532cc6.tar.gz rust-47ea6d90b073ab977cf072e2f5f46d63de532cc6.zip | |
Auto merge of #74091 - richkadel:llvm-coverage-map-gen-4, r=tmandry
Generating the coverage map @tmandry @wesleywiser rustc now generates the coverage map and can support (limited) coverage report generation, at the function level. Example commands to generate a coverage report: ```shell $ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu $ $BUILD/stage1/bin/rustc -Zinstrument-coverage \ $HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs $ LLVM_PROFILE_FILE="main.profraw" ./main called $ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata $ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main ```  r? @wesleywiser Rust compiler MCP rust-lang/compiler-team#278 Relevant issue: #34701 - Implement support for LLVMs code coverage instrumentation
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 8f0cf4361e7..049f51fb103 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1958,8 +1958,14 @@ extern "rust-intrinsic" { /// Internal placeholder for injecting code coverage counters when the "instrument-coverage" /// option is enabled. The placeholder is replaced with `llvm.instrprof.increment` during code /// generation. + #[cfg(not(bootstrap))] #[lang = "count_code_region"] - pub fn count_code_region(index: u32, start_byte_pos: u32, end_byte_pos: u32); + pub fn count_code_region( + function_source_hash: u64, + index: u32, + start_byte_pos: u32, + end_byte_pos: u32, + ); /// Internal marker for code coverage expressions, injected into the MIR when the /// "instrument-coverage" option is enabled. This intrinsic is not converted into a @@ -1967,6 +1973,8 @@ extern "rust-intrinsic" { /// "coverage map", which is injected into the generated code, as additional data. /// This marker identifies a code region and two other counters or counter expressions /// whose sum is the number of times the code region was executed. + #[cfg(not(bootstrap))] + #[lang = "coverage_counter_add"] pub fn coverage_counter_add( index: u32, left_index: u32, @@ -1978,6 +1986,8 @@ extern "rust-intrinsic" { /// This marker identifies a code region and two other counters or counter expressions /// whose difference is the number of times the code region was executed. /// (See `coverage_counter_add` for more information.) + #[cfg(not(bootstrap))] + #[lang = "coverage_counter_subtract"] pub fn coverage_counter_subtract( index: u32, left_index: u32, |
