<div dir="ltr">This information should be available from ASTContext::getParents.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 2, 2014 at 6:56 AM, Aaron W. Hsu <span dir="ltr"><<a href="mailto:arcfide@sacrideo.us" target="_blank">arcfide@sacrideo.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Clang Dev:<br>
<br>
I have a RecursiveASTVisitor. I'd like to know the relative relationship<br>
between a node I'm currently visiting with the previous node visited.<br>
Basically, I'm trying to write a visitor which gives back an array of<br>
the depths of each node during the traversal. So, if a node is a child<br>
of the previously visited node, then its depth is 1 more than the depth<br>
of the previous node, and if it is a sibling it is the same. If it is a<br>
cousin of some sort, it's more difficult, and I would need to know just<br>
how far away that node is from the previous.<br>
<br>
Another approach would be to just determine this depth directly given a<br>
node and walk up it's parent chain to the root. I'm find with doing this<br>
as well, but I can't seem to find something that gives me the parent of<br>
a node.<br>
<br>
Yours truly,<br>
Aaron W. Hsu<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Aaron W. Hsu | <a href="mailto:arcfide@sacrideo.us">arcfide@sacrideo.us</a> | <a href="http://www.sacrideo.us" target="_blank">http://www.sacrideo.us</a><br>
Please support my work: <a href="https://www.gratipay.com/arcfide/" target="_blank">https://www.gratipay.com/arcfide/</a><br>
לֵ֤ב חֲכָמִים֙ בְּבֵ֣ית אֵ֔בֶל וְלֵ֥ב כְּסִילִ֖ים בְּבֵ֥ית שִׂמְחָֽה׃<br>
<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>
</font></span></blockquote></div><br></div>