<div dir="ltr">I am very basic thing now<div>I inherited RecursiveASTVisitor Class and  overloaded function VisitStmt as</div><div><div>bool VisitStmt(Stmt *s)</div><div><span class="" style="white-space:pre"> </span>{</div>

<div><span class="" style="white-space:pre">            </span>if(isa<ForStmt>(s))</div><div><span class="" style="white-space:pre">          </span>{</div><div><span class="" style="white-space:pre">                  </span>std::cout<<"For Statement found\n";</div>

<div><span class="" style="white-space:pre">                    </span>VarDecl *D=cast<ForStmt>(s)->getConditionVariable();</div><div><span class="" style="white-space:pre">                      </span>if(D->isLocalVarDecl())</div><div><span class="" style="white-space:pre">                         </span>llvm::errs()<<"local";</div>

<div><span class="" style="white-space:pre">            }</span></div></div><div><span class="" style="white-space:pre">               return true;</span></div><div><span class="" style="white-space:pre">     }</span></div>
<div>
<span class="" style="white-space:pre">but I am facing runtime error.(seg fault) any clue?</span></div><div><span class="" style="white-space:pre"><br></span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Thu, Sep 26, 2013 at 7:35 PM, Madhur Amilkanthwar <span dir="ltr"><<a href="mailto:madhur13490@gmail.com" target="_blank">madhur13490@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 dir="ltr">Ohk..this looks cool. Let me try that. Thanks.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Sep 26, 2013 at 6:37 PM, Gabor Kozar <span dir="ltr"><<a href="mailto:kozargabor@gmail.com" target="_blank">kozargabor@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>




<div><div>The simplest probably would be finding all relevant loop nodes, i.e. ForExpr-s, identifying the loop induction variable, i.e. the VarDecl-s (if any), and finally running a RecursiveASTVisitor on its body, looking for a DeclRefExpr referring to any of the VarDecl-s you identified in the previous step.<br>


</div>
<div> </div>
<div><div>-- <br></div>
<div>  Gábor Kozár -- ShdNx<br></div>
<div>  <a href="mailto:kozargabor@gmail.com" target="_blank">kozargabor@gmail.com</a><br></div>
<div> </div>
</div><div><div>
<div> </div>
<div> </div>
<div>On Thu, Sep 26, 2013, at 15:00, Madhur Amilkanthwar wrote:<br></div>
</div></div><blockquote type="cite"><div><div><div dir="ltr"><div><div><div><div><div>Hi,<br></div>
<div>I am interested in knowing if an expression is derived from loop induction variable or not. As of now, I am able to inspect every expression after locating "if" statement in the code.

<br></div>
<div>Assume following code:<br></div>
</div>
<div>for(int i=0;i<32;i++)<br></div>
</div>
<div>  i=i+2;<br></div>
<div> </div>
</div>
<div>in above code, I am able to get access to the expression "i+2" but how should I analyze its LHS and RHS for induction variable?<br></div>
<div> </div>
</div>
<div>Any help appreciated. <br></div>
<div><div><div><div><div><div> </div>
<div>-- <br></div>
<div>Thank You.<br></div>
<div>Madhur D. Amilkanthwar<br></div>
<div>RISE lab,<br></div>
<div>IIT Madras.
<br></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div><div><u>_______________________________________________</u><br></div>
<div>cfe-dev mailing list<br></div>
<div><a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br></div>
<div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></div>
</blockquote></div>

<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thank You.<br>Madhur D. Amilkanthwar<br>RISE lab,<br>IIT Madras.<br>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thank You.<br>Madhur D. Amilkanthwar<br>RISE lab,<br>IIT Madras.<br>
</div>