<div dir="ltr">On Sat, Oct 12, 2013 at 10:47 AM, James Dennett <span dir="ltr"><<a href="mailto:james.dennett@gmail.com" target="_blank">james.dennett@gmail.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">On Fri, Oct 11, 2013 at 8:50 AM, Kirk Fertitta<br>
<<a href="mailto:kirk@pacificmindworks.com">kirk@pacificmindworks.com</a>> wrote:<br>
> Is there a way to run a matcher directly on just the main source file only,<br>
> as opposed to all of the includes? I know I can discriminate in my callback,<br>
> but didn’t know if the “penalty” for traversing so much code was negligible<br>
> or somehow avoidable.<br>
><br>
> Any advice is much appreciated.<br>
<br>
</div>You don't have to traverse it all.  You can implement your own<br>
TraverseDecl that (roughly) checks which file a Decl is in, returning<br>
true early if it's not in a file of interest and calling the default<br>
RecursiveASTVisitor::TraverseDecl otherwise.<br></blockquote><div><br></div><div>While possible, I'd advise against doing your own AST traversal - it is quite an undertaking, and very easy to get wrong.</div><div> <br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-- James<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">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>
</div></div></blockquote></div><br></div></div>