diff options
author | Dehao Chen <dehao@google.com> | 2016-04-22 21:31:18 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2016-04-22 21:31:18 +0000 |
commit | 18ce9d82c6ec4be482fe8f1f29e0a99a854fd9e1 (patch) | |
tree | 9bfaa06a49b0ef14016ce8e2af564824c642294b | |
parent | 87d80dbfda36b4cd45cf8502abc37d00d5bb8b96 (diff) | |
download | bcm5719-llvm-18ce9d82c6ec4be482fe8f1f29e0a99a854fd9e1.tar.gz bcm5719-llvm-18ce9d82c6ec4be482fe8f1f29e0a99a854fd9e1.zip |
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
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index 759f90e41b6..e3da87709de 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -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 |