<div dir="ltr">On Mon, Jun 17, 2013 at 3:06 PM, Edwin Vane <span dir="ltr"><<a href="mailto:edwin.vane@intel.com" target="_blank">edwin.vane@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 class="im"><br>
<br>
================<br>
Comment at: cpp11-migrate/LoopConvert/VariableNaming.cpp:111<br>
@@ +110,3 @@<br>
+  while(DeclAncestor != NULL) {<br>
+    if (const TemplateDecl *T = dyn_cast<TemplateDecl>(DeclAncestor)) {<br>
+      // Check that the symbol is not a template parameter of the current<br>
----------------<br>
</div><div class="im">Manuel Klimek wrote:<br>
> Edwin Vane wrote:<br>
> > I think we could get away with just using DeclContexts directly and not making a whole DeclAncestor map. The information being stored in that map is just a replication of what's available by moving up the DeclContext chain.<br>

> +1. Also, if you have some declaration reference in your statement at whose level you're trying to insert, you could get from that declrefexpr to the decl, and then get up the declcontext chain.<br>
><br>
> Also, I'd be interested why using getParent from ASTContext doesn't give you what you want (and you can even use that with hasAncestor to directly get to the decl you're interested in from the matcher without the need to drill through all this yourself).<br>

</div>I think the not using ASTContext's parent map is my fault. I suggested trying to use RevereseAST since this transform was already populating a kind of parent map. I figured why incur the cost of constructing that map a second time. But perhaps it is better to use after all?<br>
</blockquote><div><br></div><div style>I noticed on the other mail thread that you'll probably want the "lookup parent" from the DeclContext, so I think to simulate unqualified lookup we don't need a parent map at all (apart perhaps from noticing that we're in the right "branch" where there are multiple parents for the same statement).</div>
<div style><br></div><div style>Cheers,</div><div style>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D950" target="_blank">http://llvm-reviews.chandlerc.com/D950</a><br>
</blockquote></div><br></div></div>