<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Hello, </div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">I found a weird thing in llvm 3.3:</div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">For exactly the same MDNode  *space,  if I cast it to DILocation  loc(space) and call loc.getFileName(),   or I cast it to DIScope sco(space) and call sco.getFilename(),   the return value would be different ! Totally two different files</div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">I don't know if it's a bug or why it is happening like this, and what's the conceptual difference between these two classes: DIScope and DILocation ?</div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Thanks ! </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 12:43 PM, Hui Zhang <span dir="ltr"><<a href="mailto:wayne.huizhang@gmail.com" target="_blank">wayne.huizhang@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:large">​Thank you !</div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Yes, it's very nice ​</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Tue, Nov 3, 2015 at 12:21 PM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Nov 3, 2015, at 8:26 AM, Hui Zhang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:large">Hello,</div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:large">For some reason,  I have to stick on llvm 3.3 for a language compiler, I find that the location debug info is attached to each instruction using !dbg, however, I found some of that information is mis-attched and need to be changed, so I want to <b>know what functions(I checked all funcs in DIBuilder.h but didn't find a appropriate one) are used to attach those !dbg nodes to each instruction ?</b> It would be even better if you can points to the places that clang uses to create those nodes.</div><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div></div></div></blockquote><div><br></div></span><div>Have a look at IRBuilder instead:</div><div><br></div><div><table style="font-family:'Lucida Grande',Verdana,Geneva,Arial,sans-serif;font-size:13px;line-height:1.3;border-spacing:0px;padding:0px;color:rgb(0,0,0)"><tbody><tr><td align="right" valign="top" style="background-color:rgb(249,250,252);border-style:solid none none;border-top-width:1px;border-top-color:rgb(196,207,229);margin:4px;padding:1px 0px 0px 8px;white-space:nowrap">void </td><td valign="bottom" style="background-color:rgb(249,250,252);border-style:solid none none;border-top-width:1px;border-top-color:rgb(196,207,229);margin:4px;padding:1px 0px 0px 8px;width:1286px"><a href="http://llvm.org/doxygen/classllvm_1_1IRBuilderBase.html#a63fc74646456a3bed261512f21efe29c" style="color:rgb(70,101,162);font-weight:bold;text-decoration:none" target="_blank">SetCurrentDebugLocation</a> (<a href="http://llvm.org/doxygen/classllvm_1_1DebugLoc.html" style="color:rgb(70,101,162);font-weight:bold;text-decoration:none" target="_blank">DebugLoc</a> L)</td></tr><tr><td style="background-color:rgb(249,250,252);border:none;margin:4px;padding:0px 8px 4px;color:rgb(85,85,85)"> </td><td style="background-color:rgb(249,250,252);border:none;margin:4px;padding:0px 8px 4px;color:rgb(85,85,85)">Set location information used by debugging information.  <a href="http://llvm.org/doxygen/classllvm_1_1IRBuilderBase.html#a63fc74646456a3bed261512f21efe29c" style="color:rgb(70,101,162);text-decoration:none" target="_blank"></a><br></td></tr><tr><td align="right" valign="top" style="background-color:rgb(249,250,252);border-style:solid none none;border-top-width:1px;border-top-color:rgb(196,207,229);margin:4px;padding:1px 0px 0px 8px;white-space:nowrap"><a href="http://llvm.org/doxygen/AArch64PromoteConstant_8cpp.html#a90f8350fecae261c25be85d38b451bff" style="color:rgb(70,101,162);font-weight:bold;text-decoration:none" target="_blank">const</a> <a href="http://llvm.org/doxygen/classllvm_1_1DebugLoc.html" style="color:rgb(70,101,162);font-weight:bold;text-decoration:none" target="_blank">DebugLoc</a> & </td><td valign="bottom" style="background-color:rgb(249,250,252);border-style:solid none none;border-top-width:1px;border-top-color:rgb(196,207,229);margin:4px;padding:1px 0px 0px 8px;width:1286px"><a href="http://llvm.org/doxygen/classllvm_1_1IRBuilderBase.html#a2514366416ab188b68243c19a765603e" style="color:rgb(70,101,162);font-weight:bold;text-decoration:none" target="_blank">getCurrentDebugLocation</a> () <a href="http://llvm.org/doxygen/AArch64PromoteConstant_8cpp.html#a90f8350fecae261c25be85d38b451bff" style="color:rgb(70,101,162);font-weight:bold;text-decoration:none" target="_blank">const</a></td></tr><tr><td style="background-color:rgb(249,250,252);border:none;margin:4px;padding:0px 8px 4px;color:rgb(85,85,85)"> </td><td style="background-color:rgb(249,250,252);border:none;margin:4px;padding:0px 8px 4px;color:rgb(85,85,85)">Get location information used by debugging information. </td></tr></tbody></table><span><font color="#888888"><div><br></div><div>-- adrian</div></font></span><div><br></div><div>PS: Isn’t it nice how we consistently name accessor functions?</div></div></div><br></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="">-- <br><div>Best regards<br><br><br>Hui Zhang<br></div>
</span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Best regards<br><br><br>Hui Zhang<br></div>
</div>