<div dir="ltr">Hi Laszlo,<div><br></div><div>Thanks for this.<br><div><br></div><div>Regards,</div><div>Peter</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 21, 2013 at 11:38 AM, Laszlo Nagy <span dir="ltr"><<a href="mailto:rizsotto.mailinglist@gmail.com" target="_blank">rizsotto.mailinglist@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">Hi Peter,<div><br></div><div>the pointer returned by getDecl() is a perfect unique identifier inside your program. Should feel all right! ;) If you want to report to the user, you can refer with the name and the line number it was declared.</div>

<div><br></div><div>Regards,</div><div>Laszlo</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 20, 2013 at 1:32 PM, Peter Jacobsen <span dir="ltr"><<a href="mailto:jacobsen.peter@gmail.com" target="_blank">jacobsen.peter@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hi,<br>
<br>
Referring to the code below, as I climb the Clang AST, when I arrive at the<br>
DeclRefExpr refering to x on the lhs of the assignment x=2, how do I detect<br>
that it is the block scope x, rather than the function scope x?<br>
<br>
void f()<br>
{<br>
  int x;<br>
  x=1;<br>
  {<br>
    int x;<br>
    x=2;<br>
  }<br>
  gx=x;<br>
}<br>
<br>
I need unique identifiers for the each x, so my symbolic execution<br>
calculates the correct value for gx. Currently I am calling getDecl() and<br>
then getQualifiedNameAsString().  I have tried calling getDeclContext, but<br>
in references to both xs, I get a CXXMethod as the context.<br>
Presumably I could use the value of the pointer returned by getDecl(), but<br>
this doesn’t feel right.<br>
<br>
Any help much appreciated.<br>
<br>
Thanks,<br>
Peter<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/Shadowed-local-variables-tp4033981.html" target="_blank">http://clang-developers.42468.n3.nabble.com/Shadowed-local-variables-tp4033981.html</a><br>


Sent from the Clang Developers mailing list archive at Nabble.com.<br>
<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>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>