diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-10-24 22:05:42 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-10-25 12:42:42 +1100 |
| commit | 0356908cf5e5ead075608709663a38b51c584872 (patch) | |
| tree | d9039eee7749307105c3564070d5963be75c9ed2 /compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | |
| parent | 0a96176533ad5c0f8dc3b42c64bf907fb9c27f0b (diff) | |
| download | rust-0356908cf5e5ead075608709663a38b51c584872.tar.gz rust-0356908cf5e5ead075608709663a38b51c584872.zip | |
coverage: Store `covfun_section_name` in the codegen context
Adding an extra `OnceCell` to `CrateCoverageContext` is much nicer than trying to thread this string through multiple layers of function calls that already have access to the context.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs index 7a2a802eb4e..5b39d078e0d 100644 --- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs +++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs @@ -1,4 +1,4 @@ -use std::ffi::{CStr, CString}; +use std::ffi::CString; use itertools::Itertools as _; use rustc_abi::Align; @@ -81,7 +81,6 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) { generate_covmap_record(cx, covmap_version, filenames_size, filenames_val); let mut unused_function_names = Vec::new(); - let covfun_section_name = coverageinfo::covfun_section_name(cx); // Encode coverage mappings and generate function records for (instance, function_coverage) in function_coverage_entries { @@ -112,7 +111,6 @@ pub(crate) fn finalize(cx: &CodegenCx<'_, '_>) { generate_covfun_record( cx, - &covfun_section_name, mangled_function_name, source_hash, filenames_ref, @@ -360,7 +358,6 @@ fn generate_covmap_record<'ll>( /// as a global variable in the `__llvm_covfun` section. fn generate_covfun_record( cx: &CodegenCx<'_, '_>, - covfun_section_name: &CStr, mangled_function_name: &str, source_hash: u64, filenames_ref: u64, @@ -401,7 +398,7 @@ fn generate_covfun_record( llvm::set_global_constant(llglobal, true); llvm::set_linkage(llglobal, llvm::Linkage::LinkOnceODRLinkage); llvm::set_visibility(llglobal, llvm::Visibility::Hidden); - llvm::set_section(llglobal, covfun_section_name); + llvm::set_section(llglobal, cx.covfun_section_name()); // LLVM's coverage mapping format specifies 8-byte alignment for items in this section. llvm::set_alignment(llglobal, Align::EIGHT); if cx.target_spec().supports_comdat() { |
