<div dir="ltr">Test case?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 22, 2016 at 2:31 PM, Dehao Chen via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dehao<br>
Date: Fri Apr 22 16:31:18 2016<br>
New Revision: 267226<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=267226&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=267226&view=rev</a><br>
Log:<br>
Update discriminator assignment algorithm in clang assembler.<br>
<br>
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.<br>
<br>
Reviewers: dnovillo, davidxl, echristo<br>
<br>
Subscribers: echristo, llvm-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D19436" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19436</a><br>
<br>
Modified:<br>
    llvm/trunk/lib/MC/MCDwarf.cpp<br>
<br>
Modified: llvm/trunk/lib/MC/MCDwarf.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=267226&r1=267225&r2=267226&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=267226&r1=267225&r2=267226&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)<br>
+++ llvm/trunk/lib/MC/MCDwarf.cpp Fri Apr 22 16:31:18 2016<br>
@@ -112,6 +112,12 @@ EmitDwarfLineTable(MCObjectStreamer *MCO<br>
             ie = LineEntries.end();<br>
        it != ie; ++it) {<br>
<br>
+    int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;<br>
+<br>
+    // Discriminator will be cleared if there is line change.<br>
+    if (LineDelta != 0)<br>
+      Discriminator = 0;<br>
+<br>
     if (FileNum != it->getFileNum()) {<br>
       FileNum = it->getFileNum();<br>
       MCOS->EmitIntValue(dwarf::DW_LNS_set_file, 1);<br>
@@ -146,7 +152,6 @@ EmitDwarfLineTable(MCObjectStreamer *MCO<br>
     if (it->getFlags() & DWARF2_FLAG_EPILOGUE_BEGIN)<br>
       MCOS->EmitIntValue(dwarf::DW_LNS_set_epilogue_begin, 1);<br>
<br>
-    int64_t LineDelta = static_cast<int64_t>(it->getLine()) - LastLine;<br>
     MCSymbol *Label = it->getLabel();<br>
<br>
     // At this point we want to emit/create the sequence to encode the delta in<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>