<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Hi Duncan, this commit seems to skip the update to lastDL in BitcodeWriter.cpp:WriteFunction.  Is that intentional?</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Message: 7<br>
Date: Mon, 30 Mar 2015 19:40:05 -0000<br>
From: "Duncan P. N. Exon Smith" <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>><br>
To: <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
Subject: [llvm] r233585 - IR: Use the new DebugLoc API, NFC<br>
Message-ID: <<a href="mailto:20150330194005.99A792A6C02F@llvm.org" target="_blank">20150330194005.99A792A6C02F@llvm.org</a>><br>
Content-Type: text/plain; charset="utf-8"<br>...</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=233585&r1=233584&r2=233585&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=233585&r1=233584&r2=233585&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)<br>
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Mar 30 14:40:05 2015<br>
@@ -2089,7 +2089,7 @@ static void WriteFunction(const Function<br>
<br>
   bool NeedsMetadataAttachment = false;<br>
<br>
-  DebugLoc LastDL;<br>
+  MDLocation *LastDL = nullptr;<br>
<br>
   // Finally, emit all the instructions, in order.<br>
   for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)<br>
@@ -2104,10 +2104,9 @@ static void WriteFunction(const Function<br>
       NeedsMetadataAttachment |= I->hasMetadataOtherThanDebugLoc();<br>
<br>
       // If the instruction has a debug location, emit it.<br>
-      DebugLoc DL = I->getDebugLoc();<br>
-      if (DL.isUnknown()) {<br>
+      MDLocation *DL = I->getDebugLoc();<br>
+      if (!DL)<br>
         continue;<br>
-      }<br>
<br>
       if (DL == LastDL) {<br>
         // Just repeat the same debug loc as last time.<br>
@@ -2115,18 +2114,12 @@ static void WriteFunction(const Function<br>
         continue;<br>
       }<br>
<br>
-      MDNode *Scope, *IA;<br>
-      DL.getScopeAndInlinedAt(Scope, IA, I->getContext());<br>
-      assert(Scope && "Expected valid scope");<br>
-<br>
-      Vals.push_back(DL.getLine());<br>
-      Vals.push_back(DL.getCol());<br>
-      Vals.push_back(VE.getMetadataOrNullID(Scope));<br>
-      Vals.push_back(VE.getMetadataOrNullID(IA));<br>
+      Vals.push_back(DL->getLine());<br>
+      Vals.push_back(DL->getColumn());<br>
+      Vals.push_back(VE.getMetadataOrNullID(DL->getScope()));<br>
+      Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt()));<br>
       Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);<br>
       Vals.clear();<br>
-<br>
-      LastDL = DL;<br>
     }<br>
<br><br></blockquote></div></div></div>