diff options
| author | Adam Perry <adam.n.perry@gmail.com> | 2019-10-09 08:25:41 -0700 | 
|---|---|---|
| committer | Adam Perry <adam.n.perry@gmail.com> | 2019-10-27 12:50:52 -0700 | 
| commit | 743964ad3fe566ca2ce5c2de14f8733887d283fd (patch) | |
| tree | 3f8e84bcab7700d4d5a7c25d330c3338888b9605 /src/librustc_codegen_llvm/common.rs | |
| parent | fcf516d827300d21eb9f6312e799578b6f359d5d (diff) | |
| download | rust-743964ad3fe566ca2ce5c2de14f8733887d283fd.tar.gz rust-743964ad3fe566ca2ce5c2de14f8733887d283fd.zip  | |
Implement core::intrinsics::caller_location.
Returns a `&core::panic::Location` corresponding to where it was called, also making `Location` a lang item.
Diffstat (limited to 'src/librustc_codegen_llvm/common.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/common.rs | 7 | 
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index a1a5232d588..b4b82f67c74 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -237,6 +237,13 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { unsafe { llvm::LLVMConstReal(t, val) } } + fn const_str(&self, s: Symbol) -> (&'ll Value, &'ll Value) { + let len = s.as_str().len(); + let cs = consts::ptrcast(self.const_cstr(s, false), + self.type_ptr_to(self.layout_of(self.tcx.mk_str()).llvm_type(self))); + (cs, self.const_usize(len as u64)) + } + fn const_struct( &self, elts: &[&'ll Value],  | 
