<div dir="ltr">Hi List,<div><br></div><div>I have implemented the functionality of 'Goto Declaration' using the following pseudo code:</div><div><br></div><div>First, we obtain the cursor using 'location' and TU:</div>

<div><br></div><div>------------
</div><div>CXTranslationUnit tu = cache.GetTU()</div><div>CXCursor c = clang_getCursor(tu, location)</div><div><br></div><div>if(clang_isInvalid(c.kind)))</div><div>    return</div><div><br></div><div>if(is_reference_cursor(c))</div>

<div>    c = clang_getCursorReferenced(c);</div><div><br></div><div> clang_getCursorLocation(c)
</div><div>------------</div><div><br></div><div>This works like a charm, however, with my old code completion engine (an in-house flex/yacc grammar) I was able to distinguish between the 'declaration' and the 'implementation' of a function and offer it to the user.</div>

<div><br></div><div>For example:</div><div><br></div><div>a.h</div><div>------</div><div>class A {</div><div>void foo(); // declaration</div><div>};</div><div><br></div><div>a.cpp</div><div>--------</div><div>// Implementation</div>

<div>void A::foo() {}</div><div><br></div><div>I was not able to implement this functionality using libclang</div><div>It seems that the cursor is always pointing to the 'Declaration' of a function</div><div>Is there something that I am missing that will give me the location of the implementation?</div>

<div><br></div><div>Any advise?<br clear="all"><div><br></div>-- <br><div dir="ltr">Eran Ifrah<br>Author of the cross platform, open source C++ IDE: <a href="http://www.codelite.org" target="_blank">http://www.codelite.org</a><br>

YTubePlayer <a href="http://www.ytubeplayer.com" target="_blank">http://www.ytubeplayer.com</a></div><br>
</div></div>