diff options
| author | Chris Simpkins <git.simpkins@gmail.com> | 2020-03-12 09:53:49 -0400 | 
|---|---|---|
| committer | Chris Simpkins <git.simpkins@gmail.com> | 2020-03-12 09:57:05 -0400 | 
| commit | cf929f77bffc9786fa7c15e75be7599cfc551225 (patch) | |
| tree | d664ceba4e6e9772b58abdb198708a20b3257c74 /src/librustc_codegen_llvm/common.rs | |
| parent | 5d04ce67fd14538d03fa47a2598f80d49fd564c6 (diff) | |
| download | rust-cf929f77bffc9786fa7c15e75be7599cfc551225.tar.gz rust-cf929f77bffc9786fa7c15e75be7599cfc551225.zip | |
support LLVM globals corresponding to miri allocations
Diffstat (limited to 'src/librustc_codegen_llvm/common.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/common.rs | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 1d6bfb32159..d2d8097233a 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -259,11 +259,14 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { let base_addr = match alloc_kind { Some(GlobalAlloc::Memory(alloc)) => { let init = const_alloc_to_llvm(self, alloc); - if alloc.mutability == Mutability::Mut { - self.static_addr_of_mut(init, alloc.align, None) - } else { - self.static_addr_of(init, alloc.align, None) + let value = match alloc.mutability { + Mutability::Mut => self.static_addr_of_mut(init, alloc.align, None), + _ => self.static_addr_of(init, alloc.align, None), + }; + if !self.sess().fewer_names() { + llvm::set_value_name(value, format!("{:?}", ptr.alloc_id).as_bytes()); } + value } Some(GlobalAlloc::Function(fn_instance)) => self.get_fn_addr(fn_instance), Some(GlobalAlloc::Static(def_id)) => { | 
