fix(builder.rs): Add cfg(feature = "master") to set_location

This commit is contained in:
tempdragon 2024-02-28 10:04:25 +08:00
parent 5b053a3c3c
commit 6170f48e3f
2 changed files with 10 additions and 14 deletions

View File

@ -26,7 +26,6 @@
use rustc_data_structures::fx::FxHashSet;
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
use rustc_middle::mir::Rvalue;
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
use rustc_middle::ty::layout::{FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers, TyAndLayout};
use rustc_span::Span;
@ -401,9 +400,8 @@ impl<'gcc, 'tcx> BackendTypes for Builder<'_, 'gcc, 'tcx> {
pub fn set_rval_location<'a, 'gcc, 'tcx>(bx: &mut Builder<'a,'gcc,'tcx>, r:RValue<'gcc>) -> RValue<'gcc> {
if bx.loc.is_some(){
unsafe {
r.set_location(bx.loc.unwrap());
}
#[cfg(feature = "master")]
r.set_location(bx.loc.unwrap());
}
r
@ -545,9 +543,8 @@ fn mul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
fn fmul(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let i=a * b;
if self.loc.is_some() {
unsafe{
i.set_location(self.loc.clone().unwrap());
}
#[cfg(feature = "master")]
i.set_location(self.loc.clone().unwrap());
}
i
}
@ -666,7 +663,8 @@ fn or(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let ret = self.cx.gcc_or(a, b, self.loc);
if self.loc.is_some() {
unsafe { ret.set_location(self.loc.unwrap()); }
#[cfg(feature = "master")]
ret.set_location(self.loc.unwrap());
}
ret
}

View File

@ -32,10 +32,8 @@ fn dbg_var_addr(
_fragment: Option<Range<Size>>,
) {
// Not sure if this is correct, probably wrong but still keep it here.
unsafe {
#[cfg(feature = "master")]
variable_alloca.set_location(dbg_loc);
}
#[cfg(feature = "master")]
variable_alloca.set_location(dbg_loc);
}
fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
@ -45,7 +43,7 @@ fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
/// Currently, this function is not yet implemented. It seems that the
/// debug name and the mangled name should both be included in the LValues.
/// Besides, a function to get the rvalue type(m_is_lvalue) should also be included.
fn set_var_name(&mut self, value: RValue<'gcc>, name: &str) {
fn set_var_name(&mut self, _value: RValue<'gcc>, _name: &str) {
//unimplemented!();
}
@ -264,7 +262,7 @@ fn dbg_loc(
}
rustc_span::RealFileName::Remapped {
local_path,
virtual_name,
virtual_name:_,
} => if let Some(name) = local_path.as_ref() {
if let Some(name) = name.to_str(){
self.context.new_location(