]> git.lizzy.rs Git - rust.git/commitdiff
Misc debuginfo.rs changes
authorbjorn3 <bjorn3@users.noreply.github.com>
Fri, 1 Feb 2019 18:31:26 +0000 (19:31 +0100)
committerbjorn3 <bjorn3@users.noreply.github.com>
Fri, 1 Feb 2019 18:31:26 +0000 (19:31 +0100)
src/debuginfo.rs

index b623d45a5b1d85ed7bafe818ff224a83b98de65d..63cb7b028e53f684680086d64c6d89dc1c5d9a2e 100644 (file)
@@ -46,7 +46,6 @@ fn line_program_add_file(line_program: &mut LineProgram, file: &FileName) -> Fil
             )
         }
     }
-    
 }
 
 struct DebugReloc {
@@ -57,16 +56,20 @@ struct DebugReloc {
 }
 
 pub struct DebugContext<'tcx> {
+    // Encoding info
     encoding: Encoding,
     endian: RunTimeEndian,
-
     symbols: indexmap::IndexSet<String>,
 
-    strings: StringTable,
+    // Main data
     units: UnitTable,
     line_programs: LineProgramTable,
+
+    // Side tables
+    strings: StringTable,
     range_lists: RangeListTable,
 
+    // Global ids
     unit_id: UnitId,
     global_line_program: LineProgramId,
     unit_range_list: RangeList,
@@ -93,11 +96,12 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self {
             None => tcx.crate_name(LOCAL_CRATE).to_string(),
         };
 
-        let mut units = UnitTable::default();
         let mut strings = StringTable::default();
-        let mut line_programs = LineProgramTable::default();
         let range_lists = RangeListTable::default();
 
+        let mut units = UnitTable::default();
+        let mut line_programs = LineProgramTable::default();
+
         let global_line_program = line_programs.add(LineProgram::new(
             encoding,
             1,
@@ -140,13 +144,13 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self {
         DebugContext {
             encoding,
             endian: target_endian(tcx),
-
             symbols: indexmap::IndexSet::new(),
 
             strings,
+            range_lists,
+
             units,
             line_programs,
-            range_lists,
 
             unit_id,
             global_line_program,
@@ -194,8 +198,10 @@ pub fn emit(&mut self, artifact: &mut Artifact) {
         let mut debug_ranges = DebugRanges::from(WriterRelocate::new(self));
         let mut debug_rnglists = DebugRngLists::from(WriterRelocate::new(self));
 
-        let debug_line_offsets = self.line_programs.write(&mut debug_line).unwrap();
         let debug_str_offsets = self.strings.write(&mut debug_str).unwrap();
+
+        let debug_line_offsets = self.line_programs.write(&mut debug_line).unwrap();
+
         let range_list_offsets = self
             .range_lists
             .write(