<html>
<head></head>
<body>
<p>Hi again,</p>
<p>I couldn't find a solution for this problem, but I was wondering if I could traverse a subset of classes looking for a "memberExpr" which is referencing a certain "fieldDecl".</p>
<p>Maybe I could use:<br/>
<a href="http://clang.llvm.org/doxygen/classclang_1_1RecursiveASTVisitor.html#ac74e5ed6ab3568f7ba8819507e768050" target="_blank">http://clang.llvm.org/doxygen/classclang_1_1RecursiveASTVisitor.html#ac74e5ed6ab3568f7ba8819507e768050</a><br/>
but, how can I indicate that the traveral is only in a class or some classes?</p>
<p>BTW, what should I use instead of "Context.getTranslationUnitDecl()" as argument of "TraverseStmt(Stmt *S)"?</p>
<p>This task is really necessary for me.</p>
<p>Thanks,</p>
<p>Pedro.</p>
<div><em>El día 26 mar 2014 19:29, Pedro Delgado Perez <pedro.delgadoperez@mail.uca.es> escribió:</em></div><blockquote class="replyBlock" style="border-left: 2px solid #000083; margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><p>Hi everyone,</p>
<p>Maybe my question has a simple answer, but after a time searching for the solution, I haven't found how could I know if a fieldDecl has been referenced in a certain class.</p>
<p>An example:</p>
<p>class A{<br />   public:<br />        int a;<br />        int method(){ return a;}<br />  ...<br />};</p>
<p>class B: public A{<br />...<br />};</p>
<p>In the above example, if I use the method "isReferenced()" regarding the member variable "a", I think I will get "true" because it was returned in "method". However, if I want to know if that member was referenced within the class "B" (or a subset of classes), how could I do that? (not only in inline methods, but also in redeclarations)</p>
<p>Thanks in advance,</p>
<p>Pedro.</p>
</blockquote>
</body>
</html>