diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-10-24 14:12:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-24 14:12:18 +0200 |
| commit | da486467d4ab7a25a743d5f13e00426edefa148a (patch) | |
| tree | 9f02aa54126da5a0543bd310e75a83b51457a2f1 /compiler/rustc_codegen_llvm/src/context.rs | |
| parent | a07fc3d86508c43476a7721c091482243544bfcf (diff) | |
| parent | f75a236fe0751a0d9bfb740c32eec14da787f112 (diff) | |
| download | rust-da486467d4ab7a25a743d5f13e00426edefa148a.tar.gz rust-da486467d4ab7a25a743d5f13e00426edefa148a.zip | |
Rollup merge of #78300 - richkadel:coverage-cx, r=wesleywiser
Make codegen coverage_context optional, and check Addresses Issue #78286 Libraries compiled with coverage and linked with out enabling coverage would fail when attempting to add the library's coverage statements to the codegen coverage context (None). Now, if coverage statements are encountered while compiling / linking with `-Z instrument-coverage` disabled, codegen will *not* attempt to add code regions to a coverage map, and it will not inject the LLVM instrprof_increment intrinsic calls.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 150cedde7e8..56ff580b43b 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -324,8 +324,8 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { } #[inline] - pub fn coverage_context(&'a self) -> &'a coverageinfo::CrateCoverageContext<'tcx> { - self.coverage_cx.as_ref().unwrap() + pub fn coverage_context(&'a self) -> Option<&'a coverageinfo::CrateCoverageContext<'tcx>> { + self.coverage_cx.as_ref() } } |
