<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:large"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 4, 2015 at 11:01 AM, 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"><span class=""><br>
> On Nov 3, 2015, at 5:00 PM, Hui Zhang <<a href="mailto:wayne.huizhang@gmail.com">wayne.huizhang@gmail.com</a>> wrote:<br>
><br>
> Hello,<br>
><br>
> I found a weird thing in llvm 3.3:<br>
><br>
> 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<br>
><br>
> 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 ?<br>
><br>
<br>
</span>In the old llvm 3.3 representation, the DI* classes are just wrappers around generic MDNodes. You can look at the implementation of the various DI* classes (or even better at the source level debugging with LLVM document in the tree) to learn about their layout and how they relate to each other.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-family:georgia,serif;font-size:large;display:inline">​yea, but I don't find the description of DIScope and DILocation in source-level-debugging  document, so I don't know the layout the these two descriptors....is there another way to get that information ?​</div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-- adrian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> Thanks !<br>
><br>
> On Tue, Nov 3, 2015 at 12:43 PM, Hui Zhang <<a href="mailto:wayne.huizhang@gmail.com">wayne.huizhang@gmail.com</a>> wrote:<br>
> ​Thank you !<br>
><br>
> Yes, it's very nice ​<br>
><br>
> On Tue, Nov 3, 2015 at 12:21 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:<br>
><br>
>> On Nov 3, 2015, at 8:26 AM, Hui Zhang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> 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 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 ? It would be even better if you can points to the places that clang uses to create those nodes.<br>
>><br>
><br>
> Have a look at IRBuilder instead:<br>
><br>
> void  SetCurrentDebugLocation (DebugLoc L)<br>
>       Set location information used by debugging information.<br>
> const DebugLoc &      getCurrentDebugLocation () const<br>
>       Get location information used by debugging information.<br>
><br>
> -- adrian<br>
><br>
> PS: Isn’t it nice how we consistently name accessor functions?<br>
><br>
><br>
><br>
><br>
> --<br>
> Best regards<br>
><br>
><br>
> Hui Zhang<br>
><br>
><br>
><br>
> --<br>
> Best regards<br>
><br>
><br>
> Hui Zhang<br>
<br>
</div></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></div>