Here is the code. I am running on llvm 3.1 on Lion (Mac 10.7.4)<div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo"><b>string getFileDirectory</b>(<span style="color:#921f67"><b>const</b></span> <span style="color:#006042">Instruction</span> &I){</p>
</div><div><p style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:#006042"> MDNode</span> *MD = I.getMetadata(<span style="color:#3b3ffb">"</span><span style="text-decoration:underline;color:#3b3ffb">dbg</span><span style="color:#3b3ffb">"</span>);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span style="color:rgb(0,96,66)"> DICompileUnit</span> compileUnit(MD);</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"> return compileUnit.getDirectory().str();</p><p style="margin:0px;font-size:11px;font-family:Menlo">}</p><div><br></div>George<br><div class="gmail_quote">On Wed, Oct 3, 2012 at 12:40 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">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>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><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 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>> wrote:<br>
>><br>
>> On Tue, Oct 2, 2012 at 11:00 AM, George Baah <<a href="mailto:georgebaah@gmail.com">georgebaah@gmail.com</a>> 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>
</div></div></blockquote></div><br></div>