Skip to content

Commit d8e9148

Browse files
committed
Rustfmt debuginfo
1 parent c5c6ce8 commit d8e9148

File tree

2 files changed

+51
-51
lines changed

2 files changed

+51
-51
lines changed

src/debuginfo/line_info.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use syntax::source_map::FileName;
55
use cranelift::codegen::binemit::CodeOffset;
66

77
use gimli::write::{
8-
Address, AttributeValue, FileId, LineProgram, LineString,
9-
LineStringTable, Range, UnitEntryId,
8+
Address, AttributeValue, FileId, LineProgram, LineString, LineStringTable, Range, UnitEntryId,
109
};
1110

1211
fn line_program_add_file(
@@ -131,11 +130,15 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
131130
let entry = self.debug_context.dwarf.unit.get_mut(self.entry_id);
132131
entry.set(
133132
gimli::DW_AT_low_pc,
134-
AttributeValue::Address(Address::Symbol { symbol: self.symbol, addend: 0 }),
133+
AttributeValue::Address(Address::Symbol {
134+
symbol: self.symbol,
135+
addend: 0,
136+
}),
135137
);
136138
entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(end as u64));
137139

138-
self.debug_context.emit_location(self.entry_id, self.mir.span);
140+
self.debug_context
141+
.emit_location(self.entry_id, self.mir.span);
139142

140143
end
141144
}

src/debuginfo/mod.rs

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use cranelift::codegen::ir::{StackSlots, ValueLoc};
77
use cranelift::codegen::isa::RegUnit;
88

99
use gimli::write::{
10-
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram, LineString,
11-
Location, LocationList, Range, RangeList, UnitEntryId, Writer,
10+
self, Address, AttributeValue, DwarfUnit, Expression, LineProgram, LineString, Location,
11+
LocationList, Range, RangeList, UnitEntryId, Writer,
1212
};
1313
use gimli::{Encoding, Format, LineEncoding, Register, RunTimeEndian, X86_64};
1414

@@ -105,9 +105,7 @@ impl<'tcx> DebugContext<'tcx> {
105105
return *type_id;
106106
}
107107

108-
let new_entry = |dwarf: &mut DwarfUnit, tag| {
109-
dwarf.unit.add(dwarf.unit.root(), tag)
110-
};
108+
let new_entry = |dwarf: &mut DwarfUnit, tag| dwarf.unit.add(dwarf.unit.root(), tag);
111109

112110
let primtive = |dwarf: &mut DwarfUnit, ate| {
113111
let type_id = new_entry(dwarf, gimli::DW_TAG_base_type);
@@ -122,7 +120,11 @@ impl<'tcx> DebugContext<'tcx> {
122120
ty::Uint(_) => primtive(&mut self.dwarf, gimli::DW_ATE_unsigned),
123121
ty::Int(_) => primtive(&mut self.dwarf, gimli::DW_ATE_signed),
124122
ty::Float(_) => primtive(&mut self.dwarf, gimli::DW_ATE_float),
125-
ty::Ref(_, pointee_ty, mutbl) | ty::RawPtr(ty::TypeAndMut { ty: pointee_ty, mutbl }) => {
123+
ty::Ref(_, pointee_ty, mutbl)
124+
| ty::RawPtr(ty::TypeAndMut {
125+
ty: pointee_ty,
126+
mutbl,
127+
}) => {
126128
let type_id = new_entry(&mut self.dwarf, gimli::DW_TAG_pointer_type);
127129

128130
// Ensure that type is inserted before recursing to avoid duplicates
@@ -145,7 +147,10 @@ impl<'tcx> DebugContext<'tcx> {
145147
let type_entry = self.dwarf.unit.get_mut(type_id);
146148

147149
type_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
148-
type_entry.set(gimli::DW_AT_byte_size, AttributeValue::Udata(layout.size.bytes()));
150+
type_entry.set(
151+
gimli::DW_AT_byte_size,
152+
AttributeValue::Udata(layout.size.bytes()),
153+
);
149154

150155
self.types.insert(ty, type_id);
151156

@@ -219,14 +224,8 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
219224
.add(self.entry_id, gimli::DW_TAG_variable);
220225
let var_entry = self.debug_context.dwarf.unit.get_mut(var_id);
221226

222-
var_entry.set(
223-
gimli::DW_AT_name,
224-
AttributeValue::String(name.into_bytes()),
225-
);
226-
var_entry.set(
227-
gimli::DW_AT_type,
228-
AttributeValue::ThisUnitEntryRef(dw_ty),
229-
);
227+
var_entry.set(gimli::DW_AT_name, AttributeValue::String(name.into_bytes()));
228+
var_entry.set(gimli::DW_AT_type, AttributeValue::ThisUnitEntryRef(dw_ty));
230229

231230
var_id
232231
}
@@ -250,38 +249,36 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
250249
length: end as u64,
251250
});
252251

253-
{
254-
let value_labels_ranges = context.build_value_labels_ranges(isa).unwrap();
255-
256-
for (value_label, value_loc_ranges) in value_labels_ranges.iter() {
257-
let var_id = self.define_local(mir::Local::from_u32(value_label.as_u32()));
258-
259-
let loc_list = LocationList(
260-
value_loc_ranges
261-
.iter()
262-
.map(|value_loc_range| {
263-
Location::StartEnd {
264-
begin: Address::Symbol {
265-
symbol: self.symbol,
266-
addend: i64::from(value_loc_range.start),
267-
},
268-
end: Address::Symbol {
269-
symbol: self.symbol,
270-
addend: i64::from(value_loc_range.end),
271-
},
272-
data: Expression(translate_loc(value_loc_range.loc, &context.func.stack_slots).unwrap()),
273-
}
274-
})
275-
.collect(),
276-
);
277-
let loc_list_id = self.debug_context.dwarf.unit.locations.add(loc_list);
278-
279-
let var_entry = self.debug_context.dwarf.unit.get_mut(var_id);
280-
var_entry.set(
281-
gimli::DW_AT_location,
282-
AttributeValue::LocationListRef(loc_list_id),
283-
);
284-
}
252+
let value_labels_ranges = context.build_value_labels_ranges(isa).unwrap();
253+
254+
for (value_label, value_loc_ranges) in value_labels_ranges.iter() {
255+
let var_id = self.define_local(mir::Local::from_u32(value_label.as_u32()));
256+
257+
let loc_list = LocationList(
258+
value_loc_ranges
259+
.iter()
260+
.map(|value_loc_range| Location::StartEnd {
261+
begin: Address::Symbol {
262+
symbol: self.symbol,
263+
addend: i64::from(value_loc_range.start),
264+
},
265+
end: Address::Symbol {
266+
symbol: self.symbol,
267+
addend: i64::from(value_loc_range.end),
268+
},
269+
data: Expression(
270+
translate_loc(value_loc_range.loc, &context.func.stack_slots).unwrap(),
271+
),
272+
})
273+
.collect(),
274+
);
275+
let loc_list_id = self.debug_context.dwarf.unit.locations.add(loc_list);
276+
277+
let var_entry = self.debug_context.dwarf.unit.get_mut(var_id);
278+
var_entry.set(
279+
gimli::DW_AT_location,
280+
AttributeValue::LocationListRef(loc_list_id),
281+
);
285282
}
286283
}
287284
}

0 commit comments

Comments
 (0)