<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Dec 19, 2013 at 12:27 PM, lotay <span dir="ltr"><<a href="mailto:158481612@qq.com" target="_blank">158481612@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For example: the entry file of filemanager is "testcase.cpp", which including<br>
"#include test01.h", and "test01.h" has a class "Test", which a method<br>
declaration "void sayHi();", and implementation of "sayHi" locates in<br>
"test01.cpp".<br>
<br>
For the above assumption, how can I use the the VisitCXXMethodDecl in<br>
RecursiveASTVisitor to get the implementation of sayHi(), and When invoke<br>
the method hasBody() of VisitCXXMethodDecl when visiting the sayHi()<br>
function, hasBody() return false.<br></blockquote><div><br></div><div>You'll get a callback per declaration - in this case, you should get 2 calls of VisitCXXMethodDecl, and the second declaration is also a definition, which will have hasBody() return true.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The puzzle is how I can get the implementation of the sayHi() with<br>
"testcase.cpp" as the file entry of the source manager in the current<br>
CompilerInstance.<br>
<br>
For the constructor and deconstructor, the puzzles also arise....<br>
<br>
Thanks in advance!!<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/How-to-use-RecursiveASTVisitor-of-clang-to-visit-the-functions-implementation-in-c-tp4036699.html" target="_blank">http://clang-developers.42468.n3.nabble.com/How-to-use-RecursiveASTVisitor-of-clang-to-visit-the-functions-implementation-in-c-tp4036699.html</a><br>

Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>