rustc_codegen_llvm: create DIFiles from just SourceFiles.

This commit is contained in:
Eduard-Mihai Burtescu 2020-02-10 03:03:24 +02:00
parent 2bfb462b58
commit 9d57c417fc
6 changed files with 21 additions and 54 deletions

View file

@ -21,7 +21,7 @@ use rustc_codegen_ssa::debuginfo::type_names;
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
use rustc_codegen_ssa::traits::*;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE};
use rustc_hir::def_id::{DefId, DefIdMap, LOCAL_CRATE};
use rustc_index::vec::IndexVec;
use rustc_middle::mir;
use rustc_middle::ty::layout::HasTyCtxt;
@ -246,7 +246,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let def_id = instance.def_id();
let containing_scope = get_containing_scope(self, instance);
let loc = self.lookup_debug_loc(span.lo());
let file_metadata = file_metadata(self, &loc.file, def_id.krate);
let file_metadata = file_metadata(self, &loc.file);
let function_type_metadata = unsafe {
let fn_signature = get_function_signature(self, fn_abi);
@ -318,10 +318,8 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
file_start_pos: BytePos(0),
file_end_pos: BytePos(0),
};
let mut fn_debug_context = FunctionDebugContext {
scopes: IndexVec::from_elem(null_scope, &mir.source_scopes),
defining_crate: def_id.krate,
};
let mut fn_debug_context =
FunctionDebugContext { scopes: IndexVec::from_elem(null_scope, &mir.source_scopes) };
// Fill in all the scopes, with the information from the MIR body.
compute_mir_scopes(self, mir, fn_metadata, &mut fn_debug_context);
@ -509,9 +507,8 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
&self,
scope_metadata: &'ll DIScope,
file: &rustc_span::SourceFile,
defining_crate: CrateNum,
) -> &'ll DILexicalBlock {
metadata::extend_scope_to_file(&self, scope_metadata, file, defining_crate)
metadata::extend_scope_to_file(&self, scope_metadata, file)
}
fn debuginfo_finalize(&self) {
@ -522,7 +519,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
// names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
fn create_dbg_var(
&self,
dbg_context: &FunctionDebugContext<&'ll DIScope>,
variable_name: Symbol,
variable_type: Ty<'tcx>,
scope_metadata: &'ll DIScope,
@ -530,7 +526,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
span: Span,
) -> &'ll DIVariable {
let loc = self.lookup_debug_loc(span.lo());
let file_metadata = file_metadata(self, &loc.file, dbg_context.defining_crate);
let file_metadata = file_metadata(self, &loc.file);
let type_metadata = type_metadata(self, variable_type, span);