<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 20, 2014, at 4:34 PM, Daniel DeFreez <<a href="mailto:dcdefreez@ucdavis.edu" class="">dcdefreez@ucdavis.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Thanks for your reply Anna. I finally got a chance to play around with this again today.<br class=""></div><div class=""><br class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""> I believe with your patch, the node will get added, but the definition used will not have the body attached to it, so the analyzer will not process the body. </div></div></blockquote><div class=""><br class=""></div><div class="">Hmm, doesn't the analyzer itself use getBody() to access the body, thereby walking the list of redeclarations? It seems like it is still processing the body of the function, but maybe I don't know what to look for.</div></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">This is a good point. We might not be gaining anything by replacing the decl with the one that has a body since getBody is guaranteed to search the redeclarations regardless.</div><div class=""><br class=""></div><div class="">How about just removing both calls to isThisDeclarationADefinition() (from includeInGraph) and replacing the call to getBody with hasBody (to avoid the unnecessary AST de-serialization of the body)? That should work and would simplify the function greatly. What do you think?</div><div class=""><br class=""></div><div class="">I am not sure why some of the checks in your first patch were necessary (like this one).</div><div class="">+    // Skip definitions with previous declarations</div><div class="">+    if (FD->getPreviousDecl())<br class="">+      return false;<br class="">+<br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">How about changing the logic in the CallGraph to check if there is a redeclaration with the body and insert that one insted of the one referenced by the call? (This could also be handled on the analyzer side, but I think all the CallGraph users might prefer the declarations that have the bodies attached when those are available.) I would try to use hasBody, followed by getBody(). What do you think?</div></div></blockquote><div class=""><br class=""></div><div class="">It isn't obvious to me how to do this with hasBody / getBody directly, since the call graph node Decl isn't const. However, it can be easily done by iterating over redecls() and testing each with doesThisDeclarationHaveABody. It seems to work. Any problems with this approach?</div><div class=""><br class=""></div><div class="">Is cfe-commits the place to submit the actual patch?</div><div class=""> <br class=""></div><div class="">Thanks again for you help,<br class=""><br class="">Daniel<br class=""></div><div class=""><br class=""></div><br class=""></div></div></div></div>
</div></blockquote></div><br class=""></body></html>