<div dir="ltr"><div>As Manuel mentioned, I wouldn't worry too much about 'choking'. It shouldn't happen and if it does that'd be a bug in clang. If it failed to produce an AST you'd never get to matching anyway.<br>
<br></div>By the way, you'll find AST producting VERY slow using debug-builds of llvm and clang. If you're having performance issues, try using a release build first before deciding to look elsewhere for performance improvements.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Oct 13, 2013 at 1:48 PM, Kirk Fertitta <span dir="ltr"><<a href="mailto:kirk@pacificmindworks.com" target="_blank">kirk@pacificmindworks.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div><div class="im">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks very much Edwin. This is the sort of insight I was looking for. Quite new to Clang here. I certainly would prefer to keep it simple if I can, and
there is some perf tolerance for my application, as what I’m initially doing is building a library to do some fairly basic (but domain-specific) roundtripping on a VC++ app. So, there will be windows headers included as well as the usual suspects (MS STL,
etc). But, my roundtripping operations are always taking place in only a few files within the project. And, the operations take place in response to user-initiated commands, which means as long as the UI is “responsive” enough, I can tolerate some extra
traversal it seems. I certainly don’t feel 100% comfortable hacking the source just yet to modify the RecursiveASTVisitor.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">From a functional standpoint, should I be concerned about the matcher coming across something in the Windows headers it doesn’t understand (which I understand
will certainly happen) if I’m never concerned about matching in those headers? In other words, if I want to find a FunctionDecl in my main source file and Clang chokes on an included header, would it still likely find my main source file decl or is it an
“all-or-nothing” deal? I suppose if a type decl was in a header it didn’t understand and that type was used in the signature of my target function, then seemingly that would be a big problem.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks very much again for taking the time to answer Clang newbie questions.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Kirk Fertitta<u></u><u></u></span></p><div class="im">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Chief Technical Officer<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Pacific MindWorks, Inc.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">ph: <a href="tel:858-207-6198" value="+18582076198" target="_blank">858-207-6198</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">fax: <a href="tel:858-521-1385" value="+18585211385" target="_blank">858-521-1385</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</div><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Edwin Vane [<a href="mailto:revane@gmail.com" target="_blank">mailto:revane@gmail.com</a>]
<br></span></p><div class="im">
<b>Sent:</b> Saturday, October 12, 2013 5:52 AM<br>
<b>To:</b> Kirk Fertitta<br>
<b>Cc:</b> <a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [cfe-dev] Running ASTMatcher over main file only<u></u><u></u></div><p></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">In my experience the cost of traversing parts of the AST that come from a header is negligible. So if you reject matches in the callback for those that come from files you don't want to change that would be the best way to do it. If you're
interested in measuring the performance difference you'd have to hack the internal RecursiveASTVisitor the match finding stuff uses and include a file test at various nodes in the tree to prune the whole sub-tree. Unless your translation unit is absolutely
massive and most of it comes from files you don't care about I can't see there being much of a difference.<u></u><u></u></p>
</div><div><div class="h5">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Fri, Oct 11, 2013 at 11:50 AM, Kirk Fertitta <<a href="mailto:kirk@pacificmindworks.com" target="_blank">kirk@pacificmindworks.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal">Is there a way to run a matcher directly on just the main source file only, as opposed to all of the includes? I know I can discriminate in my callback, but didn’t know if the “penalty”
for traversing so much code was negligible or somehow avoidable.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Any advice is much appreciated.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Kirk Fertitta<u></u><u></u></p>
<p class="MsoNormal">Chief Technical Officer<u></u><u></u></p>
<p class="MsoNormal">Pacific MindWorks, Inc.<u></u><u></u></p>
<p class="MsoNormal">ph:
<a href="tel:858-207-6198" target="_blank">858-207-6198</a><u></u><u></u></p>
<p class="MsoNormal">fax:
<a href="tel:858-521-1385" target="_blank">858-521-1385</a><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <br>
Edwin V <u></u><u></u></p>
</div>
</div></div></div>
</div>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br>Edwin V
</div>