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

llvm-svn: 267226
This commit is contained in:
Dehao Chen 2016-04-22 21:31:18 +00:00
parent 87d80dbfda
commit 18ce9d82c6
1 changed files with 6 additions and 1 deletions

View File

@ -112,6 +112,12 @@ EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
ie = LineEntries.end();
it != ie; ++it) {
int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
// Discriminator will be cleared if there is line change.
if (LineDelta != 0)
Discriminator = 0;
if (FileNum != it->getFileNum()) {
FileNum = it->getFileNum();
MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);
@ -146,7 +152,6 @@ EmitDwarfLineTable(MCObjectStreamer *MCOS, MCSection *Section,
if (it->getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)
MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);
int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;
MCSymbol *Label = it->getLabel();
// At this point we want to emit/create the sequence to encode the delta in