<div dir="ltr"><div style>+cfe-dev</div><div><br></div>On Fri, Jun 14, 2013 at 9:48 PM, Bernal, Ariel J <span dir="ltr"><<a href="mailto:ariel.j.bernal@intel.com" target="_blank">ariel.j.bernal@intel.com</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal">Manuel, Douglas<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m working on a patch to prevent LoopConvert for shadowing variables <a href="http://llvm-reviews.chandlerc.com/D950" target="_blank">http://llvm-reviews.chandlerc.com/D950</a> but I don’t feel like it’s the right solution. Maybe you could shed some
light on this.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The first loop goes over CompoundStms and we look for VarDecls that could match the name of the new variable until we reach the FunctionDecl then the next loop goes over Decls to get any VarDecl/FieldDecl/ParamVarDecl... defined in a parent
context. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Unfortunately DeclContext::getParent doesn’t return the parent Decl when it comes to templates but I think it could be possible to use DeclContext instead of using a Decl-Decl map to reverse the AST.</p>
</div></div></blockquote><div><br></div><div style>Added some comments to the review thread. Also, for trying to simulate the unqualified lookup, did you also try getLookupParent()?</div><div style><br></div><div style>Regarding templates, note that statement nodes are shared between the "model" CXXRecordDecl formed by the template definition and containing lots of dependent types and the ClassTemplateSpecializationDecl, which you probably want. So it's important that the first declcontext you get to from the statement where you want to insert the declaration is the one created by the ClassTemplateSpecializationDecl.</div>
<div style><br></div><div style>Cheers,</div><div style>/Manuel</div></div></div></div>