Dear all:<br /><span class="sender"><div class="mimepart text html"><br />My name is Xiaohui Chen, a computer science student in UWO in canada and i am using Clang as the frontend of my project, but i am confusing of the following statements.<br />PS: i am a newbie. <br /><br /><pre class="fragment"><span class="comment">These tasks are done by three groups of methods, respectively:</span>
<a name="l00089" target="1"></a>00089 <span class="comment">///   1. TraverseDecl(Decl *x) does task #1.  It is the entry point</span>
<a name="l00090" target="1"></a>00090 <span class="comment">///      for traversing an AST rooted at x.  This method simply</span>
<a name="l00091" target="1"></a>00091 <span class="comment">///      dispatches (i.e. forwards) to TraverseFoo(Foo *x) where Foo</span>
<a name="l00092" target="1"></a>00092 <span class="comment">///      is the dynamic type of *x, which calls WalkUpFromFoo(x) and</span>
<a name="l00093" target="1"></a>00093 <span class="comment">///      then recursively visits the child nodes of x.</span>
<a name="l00094" target="1"></a>00094 <span class="comment">///      TraverseStmt(Stmt *x) and TraverseType(QualType x) work</span>
<a name="l00095" target="1"></a>00095 <span class="comment">///      similarly.</span>
<a name="l00096" target="1"></a>00096 <span class="comment">///   2. WalkUpFromFoo(Foo *x) does task #2.  It does not try to visit</span>
<a name="l00097" target="1"></a>00097 <span class="comment">///      any child node of x.  Instead, it first calls WalkUpFromBar(x)</span>
<a name="l00098" target="1"></a>00098 <span class="comment">///      where Bar is the direct parent class of Foo (unless Foo has</span>
<a name="l00099" target="1"></a>00099 <span class="comment">///      no parent), and then calls VisitFoo(x) (see the next list item).</span>
<a name="l00100" target="1"></a>00100 <span class="comment">///   3. VisitFoo(Foo *x) does task #3.</span>
<a name="l00101" target="1"></a>00101 <span class="comment">///</span>
<a name="l00102" target="1"></a>00102 <span class="comment">/// These three method groups are tiered (Traverse* > WalkUpFrom* ></span>
<a name="l00103" target="1"></a>00103 <span class="comment">/// Visit*).  A method (e.g. Traverse*) may call methods from the same</span>
<a name="l00104" target="1"></a>00104 <span class="comment">/// tier (e.g. other Traverse*) or one tier lower (e.g. WalkUpFrom*).</span>
<a name="l00105" target="1"></a>00105 <span class="comment">/// It may not call methods from a higher tier.</span></pre>According to the above statement, the calling relationship between these<br />functions are organized in this way in general:<br /><br />Traversal*()<br />{<br />        .......<br />        WalkUpFrom*();<br />        .......<br />}<br /><br />WalkUpFrom*()<br />{<br />         .......<br />         Visit*();<br />         .......<br /><br />}<br /><br />am i right?<br /><br />For this statement:<br /><pre class="fragment">00096 <span class="comment">///   2. WalkUpFromFoo(Foo *x) does task #2.  It does not try to visit</span>
<a name="l00097" target="1"></a>00097 <span class="comment">///      any child node of x.  Instead, it first calls WalkUpFromBar(x)</span>
<a name="l00098" target="1"></a>00098 <span class="comment">///      where Bar is the direct parent class of Foo (unless Foo has</span>
<a name="l00099" target="1"></a>00099 <span class="comment">///      no parent), and then calls VisitFoo(x) (see the next list item).</span></pre>what do you mean by saying "the direct parent class of Foo"?<br />why i need to visit the parent class before i visit the current class? <br />what is the purpose? Could you please give me a short example?<br /><br />Thank you in advance!<br /><br />Sincerely<br />xiaohui<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</div><br /><br /></span>