diff options
author | David Blaikie <dblaikie@gmail.com> | 2025-09-12 13:04:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-12 13:04:53 -0700 |
commit | aabf18d7184298566993e3141606cd79ff617d2d (patch) | |
tree | 110f400209c8e2fe886db1116c2973727f6c5851 /llvm/lib/MC/MCDwarf.cpp | |
parent | 1756b6e59cb1bbf78a9122c008ab0c6d413e1497 (diff) | |
download | llvm-aabf18d7184298566993e3141606cd79ff617d2d.zip llvm-aabf18d7184298566993e3141606cd79ff617d2d.tar.gz llvm-aabf18d7184298566993e3141606cd79ff617d2d.tar.bz2 |
Revert "[DebugLine] Correct debug line emittion" (#158343)
Reverts llvm/llvm-project#157529
Sorry, I missed that the missed that the LLVM test was using clang -
layering dictates thats not OK. Please readjust the test case to work
like the existing test coverage (or perhaps the existing test coverage
is sufficient?) and post a new PR.
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index e8f000a..e7c0d37 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -181,7 +181,7 @@ void MCDwarfLineTable::emitOne( unsigned FileNum, LastLine, Column, Flags, Isa, Discriminator; bool IsAtStartSeq; - MCSymbol *PrevLabel; + MCSymbol *LastLabel; auto init = [&]() { FileNum = 1; LastLine = 1; @@ -189,31 +189,21 @@ void MCDwarfLineTable::emitOne( Flags = DWARF2_LINE_DEFAULT_IS_STMT ? DWARF2_FLAG_IS_STMT : 0; Isa = 0; Discriminator = 0; - PrevLabel = nullptr; + LastLabel = nullptr; IsAtStartSeq = true; }; init(); // Loop through each MCDwarfLineEntry and encode the dwarf line number table. bool EndEntryEmitted = false; - for (auto It = LineEntries.begin(); It != LineEntries.end(); ++It) { - auto LineEntry = *It; - MCSymbol *CurrLabel = LineEntry.getLabel(); + for (const MCDwarfLineEntry &LineEntry : LineEntries) { + MCSymbol *Label = LineEntry.getLabel(); const MCAsmInfo *asmInfo = MCOS->getContext().getAsmInfo(); if (LineEntry.LineStreamLabel) { if (!IsAtStartSeq) { - auto *Label = CurrLabel; - auto NextIt = It + 1; - // LineEntry with a null Label is probably a fake LineEntry we added - // when `-emit-func-debug-line-table-offsets` in order to terminate the - // sequence. Look for the next Label if possible, otherwise we will set - // the PC to the end of the section. - if (!Label && NextIt != LineEntries.end()) { - Label = NextIt->getLabel(); - } - MCOS->emitDwarfLineEndEntry(Section, PrevLabel, - /*EndLabel =*/Label); + MCOS->emitDwarfLineEndEntry(Section, LastLabel, + /*EndLabel =*/LastLabel); init(); } MCOS->emitLabel(LineEntry.LineStreamLabel, LineEntry.StreamLabelDefLoc); @@ -221,7 +211,7 @@ void MCDwarfLineTable::emitOne( } if (LineEntry.IsEndEntry) { - MCOS->emitDwarfAdvanceLineAddr(INT64_MAX, PrevLabel, CurrLabel, + MCOS->emitDwarfAdvanceLineAddr(INT64_MAX, LastLabel, Label, asmInfo->getCodePointerSize()); init(); EndEntryEmitted = true; @@ -268,12 +258,12 @@ void MCDwarfLineTable::emitOne( // At this point we want to emit/create the sequence to encode the delta in // line numbers and the increment of the address from the previous Label // and the current Label. - MCOS->emitDwarfAdvanceLineAddr(LineDelta, PrevLabel, CurrLabel, + MCOS->emitDwarfAdvanceLineAddr(LineDelta, LastLabel, Label, asmInfo->getCodePointerSize()); Discriminator = 0; LastLine = LineEntry.getLine(); - PrevLabel = CurrLabel; + LastLabel = Label; IsAtStartSeq = false; } @@ -283,7 +273,7 @@ void MCDwarfLineTable::emitOne( // does not track ranges nor terminate the line table. In that case, // conservatively use the section end symbol to end the line table. if (!EndEntryEmitted && !IsAtStartSeq) - MCOS->emitDwarfLineEndEntry(Section, PrevLabel); + MCOS->emitDwarfLineEndEntry(Section, LastLabel); } void MCDwarfLineTable::endCurrentSeqAndEmitLineStreamLabel(MCStreamer *MCOS, |