<div dir="ltr">Ah, I see now that there are multiple hasBody() functions. I just tried using that hasBody(FunctionDecl *&), and it returns false. Makes sense because it's essentially the same as me manually iterating over each redecl. <div>

<br></div><div>I am indeed using ASTConsumer alongside a RecursiveASTVisitor in the libtooling environment. So you're saying that my code (some analysis inside VisitFunctionDecl or VisitStmt, per se) will be unaware of the existence of a future foo() definition until VisitFunctionDecl is called on that foo() definition?  </div>

<div><br></div><div>If so, then there is no way to inspect the body/definition of foo() until VisitFunctionDecl visits it, right? Specifically, while visiting the main() FunctionDecl*, I cannot access the Stmts inside the foo() definition? That's really what I need.</div>

<div><br>Thanks again,</div><div>Kevin </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 16, 2013 at 6:29 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com" target="_blank">eli.friedman@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Jul 16, 2013 at 4:06 PM, Kevin Boos <<a href="mailto:kevinaboos@gmail.com">kevinaboos@gmail.com</a>> wrote:<br>


> Thanks so much for your quick reply.<br>
><br>
> I have been using hasBody(), isThisDeclarationADefinition(), etc... to<br>
> determine if the Decl* i'm looking at is actually a definition -- those are<br>
> useful. I was merely testing things with the redecl chain just to see if I<br>
> could get the definition that way even if getDirectCallee() returned the<br>
> function prototype.<br>
<br>
</div>There's also a form of FunctionDecl::hasBody() which lets you retrieve<br>
the definition.<br>
<div class="im"><br>
> How would I determine if clang has parsed the definition? Sorry, I'm a bit<br>
> of a beginner here. I thought that Clang first parsed the source file, built<br>
> an AST, and then allowed you to Visit each type of AST node. All I know is,<br>
> at that point, Clang would not yet have visited the definition of foo(), but<br>
> I assume it would have parsed it...?<br>
<br>
</div>It depends on how exactly you're getting at the AST.  The ASTConsumer<br>
API in particular returns one declaration at a time.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eli<br>
</font></span></blockquote></div><br></div>