<div dir="ltr">Alberto: Thanks for your help.<div><br></div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">Maybe you can create a recursive visitor and use the VisitStmt method. Using a cast you can understand if it is an if statement and if yes you could call, for example,getThen() method or something similar.</blockquote><p style="font-size:13px">Is there any example code to start?</p><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex" class="gmail_quote">What you mean with read/write variables?</blockquote><div>I'll explain with a sample:</div><div><br></div><div><font face="monospace, monospace">std::vector<int> A(M);</font></div><div><font face="monospace, monospace">std::vector<int> B(M);</font></div><div><font face="monospace, monospace">....<br></font></div><div><font face="monospace, monospace">/* Loop to analyze */</font></div><div><font face="monospace, monospace">for (int i=0; i<M; ++i) {</font></div><div><font face="monospace, monospace"> A[i] = B[i];</font></div><div><font face="monospace, monospace">}</font></div><div><br></div><div>I would like to get the following information:</div><div><br></div><div><font face="monospace, monospace">Local: i (rw)</font></div><div><font face="monospace, monospace">External: A(w),B (r), M(r)</font></div><div><br></div><div>where <b>r</b> means that the variable is read into the code, and <b>w</b> means that the variable is modified (in someway)</div><div><br></div><div>Regards,<br></div></div><div>Luis.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-01-14 18:42 GMT+01:00 Alberto Barbaro <span dir="ltr"><<a href="mailto:barbaro.alberto@gmail.com" target="_blank">barbaro.alberto@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Luis,<br>
My 2 cents. Maybe you can create a recursive visitor and use the VisitStmt method. Using a cast you can understand if it is an if statement and if yes you could call, for example,getThen() method or something similar.</p>
<p dir="ltr">What you mean with read/write variables?</p>
<p dir="ltr">I think you can understand if it is global or not taking the declaration point using something like getDecl() on the DeclRefExpr.</p>
<p dir="ltr">I'm sure that I said something wrong. Any better idea?</p>
<p dir="ltr">Thanks,<br>
Alberto</p>
<div class="gmail_quote">On 14 Jan 2015 15:44, "Luis Miguel Sanchez Garcia" <<a href="mailto:luismiguel.sanchez@uc3m.es" target="_blank">luismiguel.sanchez@uc3m.es</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>I would like to develop a tool that prints the variables of a concrete loop/compount statement/etc. The information that I need to print for each variable is: </div><div>- read variables, write variables and rw variables</div><div>- And if it is local or global variable.</div><div><br></div><div>Any help to start?</div><div><br></div><div>Regards,<br></div><div>Luis.<br clear="all"><div><div><div dir="ltr">-- <br>-- <br>--------------------------------------------------<br>Luis Miguel Sánchez García<br><span style="border-collapse:collapse">Computer Architecture and Technology Area.</span><div>Office 2.2.B08<br><div>Computer Science Department. UNIVERSIDAD CARLOS III DE MADRID<br>Universidad Carlos III de Madrid<br>Avda. de la Universidad, 30<br>28911 Leganés - Madrid - Spain<br>e-mail: <a href="mailto:lmsan@arcos.inf.uc3m.es" target="_blank">lmsan@arcos.inf.uc3m.es</a><br> <a href="mailto:luismiguel.sanchez@uc3m.es" target="_blank">luismiguel.sanchez@uc3m.es</a><br><br></div><div>Phone: <a href="tel:%28%2B34%29%2091%20624%205951" value="+34916245951" target="_blank">(+34) 91 624 5951</a><br><div> <br>Linked-In: <a href="http://es.linkedin.com/in/lmsan" style="color:rgb(17,85,204)" target="_blank">http://es.linkedin.com/in/lmsan</a><br>Twitter: <a href="http://twitter.com/lmsanchezgarcia" style="color:rgb(17,85,204)" target="_blank">http://twitter.com/lmsanchezgarcia</a><br>--------------------------------------------------</div></div></div></div></div></div>
</div></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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;font-family:arial">-- </span><br style="font-size:small;font-family:arial"><span style="font-size:small;font-family:arial">-- </span><br style="font-size:small;font-family:arial"><span style="font-size:small;font-family:arial">--------------------------------------------------</span><br style="font-size:small;font-family:arial"><span style="font-size:small;font-family:arial">Luis Miguel Sánchez García</span><br style="font-size:small;font-family:arial"><span style="font-size:small;font-family:arial;border-collapse:collapse">Computer Architecture and Technology Area.</span><div style="font-size:small;font-family:arial">Office 2.2.B08<br><div>Computer Science Department. UNIVERSIDAD CARLOS III DE MADRID<br>Universidad Carlos III de Madrid<br>Avda. de la Universidad, 30<br>28911 Leganés - Madrid - Spain<br>e-mail: <a href="mailto:lmsan@arcos.inf.uc3m.es" style="color:rgb(17,85,204)" target="_blank">lmsan@arcos.inf.uc3m.es</a><br> <a href="mailto:luismiguel.sanchez@uc3m.es" style="color:rgb(17,85,204)" target="_blank">luismiguel.sanchez@uc3m.es</a><br><br></div><div>Phone: (+34) 91 624 5951<br><div> <br>Linked-In: <a href="http://es.linkedin.com/in/lmsan" style="color:rgb(17,85,204)" target="_blank">http://es.linkedin.com/in/lmsan</a><br>Twitter: <a href="http://twitter.com/lmsanchezgarcia" style="color:rgb(17,85,204)" target="_blank">http://twitter.com/lmsanchezgarcia</a><br>--------------------------------------------------</div></div></div></div></div></div>
</div>