<div dir="ltr"><div>Hi,</div><div><br></div><div>That seems to be correct, I'm not sure what could be the issue. Could you show us some code?</div><div><br></div><div>(I think that VisitLabelStmt's parameter type is LabelStmt*, but I do not think that could be the issue here.)</div>
<div><br></div><div>The only thing I can imagine is that you abort the tree traversal in one of your override methods. To quote the <a href="http://clang.llvm.org/doxygen/classclang_1_1RecursiveASTVisitor.html">documentation of RecursiveASTVisitor</a>:</div>
<div><br></div><div>> <em>"Advanced users may override Traverse* and WalkUpFrom* to implement custom traversal strategies. Returning false from one of these overridden functions will abort the entire traversal."</em></div>
<div><em><br></em></div><div>Try commenting out your entire visitor, and replacing it with a trivial one that ONLY overrides VisitLabelStmt, and returns true - I don't remember what the effect of returning false in a Visit* method is, but my guess would be that it causes any derived-type Visit* methods not to be called (i.e. if for a LabelStmt*, you return false from VisitStmt, then VisitLabelStmt won't be called) - but again, that's just my guess.</div>
<div><br></div><div>Hope this helps.</div><div><br></div><div>Gabor</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/14 Rajendra <span dir="ltr"><<a href="mailto:rks@cse.iitb.ac.in" target="_blank">rks@cse.iitb.ac.in</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How to get label of a LabelStmt?<br>
<br>
e.g. from code below, I want to get label MYASSERT1 and MYASSERT2, how to do<br>
that?<br>
<br>
int main()<br>
{<br>
int x, y;<br>
x = 10;<br>
MYASSERT1: x>0;<br>
y = 0;<br>
MYASSERT2: x==0;<br>
return 0;<br>
}<br>
<br>
I have written VisitLabelStmt(Stmt*) but control doesn't come to this<br>
function. Also in VisitStmt(Stmt*) when I check stmt class as "LabelStmt", I<br>
dont't get label. Any help?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/how-to-get-label-from-a-statement-and-VisitLabelExpr-tp4032103.html" target="_blank">http://clang-developers.42468.n3.nabble.com/how-to-get-label-from-a-statement-and-VisitLabelExpr-tp4032103.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>