rustc_codegen_llvm: avoid converting between DILocation and Value.

This commit is contained in:
Eduard-Mihai Burtescu
2020-02-10 22:52:20 +02:00
parent fa2b381ec8
commit 88d874de63
4 changed files with 16 additions and 13 deletions

View File

@@ -192,7 +192,8 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> {
let dbg_loc = self.cx().create_debug_loc(scope, span);
unsafe {
llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc);
let dbg_loc_as_llval = llvm::LLVMRustMetadataAsValue(self.cx().llcx, dbg_loc);
llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc_as_llval);
}
}
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {

View File

@@ -2,8 +2,8 @@ use super::metadata::{UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER};
use super::utils::debug_context;
use crate::common::CodegenCx;
use crate::llvm::debuginfo::DIScope;
use crate::llvm::{self, Value};
use crate::llvm;
use crate::llvm::debuginfo::{DILocation, DIScope};
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::sync::Lrc;
@@ -45,7 +45,7 @@ impl CodegenCx<'ll, '_> {
}
}
pub fn create_debug_loc(&self, scope: &'ll DIScope, span: Span) -> &'ll Value {
pub fn create_debug_loc(&self, scope: &'ll DIScope, span: Span) -> &'ll DILocation {
let DebugLoc { line, col, .. } = self.lookup_debug_loc(span.lo());
unsafe {