@@ -178,7 +178,7 @@ class BinaryEmitter {
178178 // / marker in the line table program, but provides one to the DWARF generator
179179 // / when it needs it.
180180 void emitLineInfoEnd (const BinaryFunction &BF, MCSymbol *FunctionEndSymbol,
181- DWARFUnit * Unit);
181+ const DWARFUnit & Unit);
182182
183183 // / Emit debug line info for unprocessed functions from CUs that include
184184 // / emitted functions.
@@ -439,7 +439,7 @@ bool BinaryEmitter::emitFunction(BinaryFunction &Function,
439439
440440 if (opts::UpdateDebugSections && !Function.getDWARFUnits ().empty ())
441441 for (const auto &[_, Unit] : Function.getDWARFUnits ())
442- emitLineInfoEnd (Function, EndSymbol, Unit);
442+ emitLineInfoEnd (Function, EndSymbol, * Unit);
443443
444444 // Exception handling info for the function.
445445 emitLSDA (Function, FF);
@@ -707,13 +707,14 @@ SMLoc BinaryEmitter::emitLineInfo(const BinaryFunction &BF, SMLoc NewLoc,
707707 CurrentRow.Discriminator );
708708 const MCDwarfLoc &DwarfLoc = BC.Ctx ->getCurrentDwarfLoc ();
709709 BC.Ctx ->clearDwarfLocSeen ();
710- auto &MapLineEntries = BC.getDwarfLineTable (TargetUnitIndex)
711- .getMCLineSections ()
712- .getMCLineEntries ();
710+ const MCLineSection::MCLineDivisionMap &MapLineEntries =
711+ BC.getDwarfLineTable (TargetUnitIndex)
712+ .getMCLineSections ()
713+ .getMCLineEntries ();
713714 const auto *It = MapLineEntries.find (Streamer.getCurrentSectionOnly ());
714- auto NewLineEntry = MCDwarfLineEntry (&InstrLabel, DwarfLoc);
715+ MCDwarfLineEntry NewLineEntry = MCDwarfLineEntry (&InstrLabel, DwarfLoc);
715716
716- // Check if line table exists and has entries before doing comparison
717+ // Check if line table exists and has entries before doing comparison.
717718 if (It != MapLineEntries.end () && !It->second .empty ()) {
718719 // Check if the new line entry has the same debug info as the last one
719720 // to avoid duplicates. We don't compare labels since different
@@ -769,12 +770,11 @@ SMLoc BinaryEmitter::emitLineInfo(const BinaryFunction &BF, SMLoc NewLoc,
769770
770771void BinaryEmitter::emitLineInfoEnd (const BinaryFunction &BF,
771772 MCSymbol *FunctionEndLabel,
772- DWARFUnit *Unit) {
773- assert (Unit && " DWARF unit expected" );
773+ const DWARFUnit &Unit) {
774774 BC.Ctx ->setCurrentDwarfLoc (0 , 0 , 0 , DWARF2_FLAG_END_SEQUENCE, 0 , 0 );
775775 const MCDwarfLoc &DwarfLoc = BC.Ctx ->getCurrentDwarfLoc ();
776776 BC.Ctx ->clearDwarfLocSeen ();
777- BC.getDwarfLineTable (Unit-> getOffset ())
777+ BC.getDwarfLineTable (Unit. getOffset ())
778778 .getMCLineSections ()
779779 .addLineEntry (MCDwarfLineEntry (FunctionEndLabel, DwarfLoc),
780780 Streamer.getCurrentSectionOnly ());
0 commit comments