Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 1e4609e

Browse files
committed
Update discriminator assignment algorithm in clang assembler.
Summary: The clang assembler assumes that the discriminator remains the same when there is source line change. The correct behavior is that when there is line change, discriminator will automatically reset to 0. Reviewers: dnovillo, davidxl, echristo Subscribers: echristo, llvm-commits Differential Revision: http://reviews.llvm.org/D19436 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267226 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent f8d640b commit 1e4609e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/MC/MCDwarf.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
112112
ie = LineEntries.end();
113113
it != ie; ++it) {
114114

115+
int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
116+
117+
// Discriminator will be cleared if there is line change.
118+
if (LineDelta != 0)
119+
Discriminator = 0;
120+
115121
if (FileNum != it->getFileNum()) {
116122
FileNum = it->getFileNum();
117123
MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);
@@ -146,7 +152,6 @@ EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
146152
if (it->getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
147153
MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
148154

149-
int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
150155
MCSymbol *Label = it->getLabel();
151156

152157
// At this point we want to emit/create the sequence to encode the delta in

0 commit comments

Comments
 (0)