[llvm] r267226 - Update discriminator assignment algorithm in clang assembler.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 14:31:18 PDT 2016


Author: dehao
Date: Fri Apr 22 16:31:18 2016
New Revision: 267226

URL: http://llvm.org/viewvc/llvm-project?rev=267226&view=rev
Log:
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

Modified:
    llvm/trunk/lib/MC/MCDwarf.cpp

Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=267226&r1=267225&r2=267226&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Fri Apr 22 16:31:18 2016
@@ -112,6 +112,12 @@ EmitDwarfLineTable(MCObjectStreamer *MCO
             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 *MCO
     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




More information about the llvm-commits mailing list