Hmmm, but it has a getDirectory function.<div><br></div><div>-G<br><br><div class="gmail_quote">On Thu, Oct 4, 2012 at 3:50 PM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That's because instructions have a location associated with them, not<br>
a compile unit.<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Oct 4, 2012 at 12:46 PM, George Baah <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>> wrote:<br>
> I used DILocation instead of DICompileUnit and it works. Hmmm, interesting.<br>
><br>
> George<br>
><br>
> On Thu, Oct 4, 2012 at 1:33 AM, George Baah <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>> wrote:<br>
>><br>
>> Here is the code. I am running on llvm 3.1 on Lion (Mac 10.7.4)<br>
>><br>
>> string getFileDirectory(const Instruction &I){<br>
>><br>
>>   MDNode *MD = I.getMetadata("dbg");<br>
>><br>
>>   DICompileUnit compileUnit(MD);<br>
>><br>
>>   return compileUnit.getDirectory().str();<br>
>><br>
>> }<br>
>><br>
>><br>
>> George<br>
>><br>
>> On Wed, Oct 3, 2012 at 12:40 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Without knowing the code that you've written and the IR that you're<br>
>>> running on I'm<br>
>>> not sure what I can do to help you.<br>
>>><br>
>>> -eric<br>
>>><br>
>>> On Wed, Oct 3, 2012 at 9:32 AM, George Baah <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>> wrote:<br>
>>> > Yeah, It looks like I am doing exactly what's in Dwarf*.cpp files, yet<br>
>>> > I am<br>
>>> > getting blanks.<br>
>>> ><br>
>>> > George<br>
>>> ><br>
>>> > On Tue, Oct 2, 2012 at 2:10 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>><br>
>>> > wrote:<br>
>>> >><br>
>>> >> On Tue, Oct 2, 2012 at 11:00 AM, George Baah <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >> > Hi Guys,<br>
>>> >> >   How does one get the directory of the compilation unit in llvm?<br>
>>> >> > I am using DICompileUnit but for some reason I am getting blanks<br>
>>> >> > for the directory name. Here is my code ...<br>
>>> >> ><br>
>>> >> > MDNode *MD = I.getMetadata("dbg");<br>
>>> >> ><br>
>>> >> > DICompileUnit compileUnit(MD);<br>
>>> >> ><br>
>>> >> > return compileUnit.getDirectory().str();<br>
>>> >> ><br>
>>> >><br>
>>> >> In general for these questions it's easier to look at how it's done in<br>
>>> >> DwarfDebug.cpp and DwarfCompileUnit.cpp.<br>
>>> >><br>
>>> >> -eric<br>
>>> ><br>
>>> ><br>
>><br>
>><br>
><br>
</div></div></blockquote></div><br></div>