<div dir="ltr">If you have a large code base, I'd suggest to parallelize per translation unit. Why do you think further parallelizing in-process would help? <div><br></div><div>If you're concerned about the intermediate file format, I think that in most cases I've seen the data is simple enough that it will beat the cost of a correct multi-threaded implementation of anything by far...</div>
<div><br></div><div>Cheers,</div><div>/Manuel</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 24, 2013 at 11:28 AM, Jesper Eskilson <span dir="ltr"><<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 09/24/2013 10:41 AM, Gabor Kozar wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
Since the AST should be immutable once created, and AST matchers are only a high-level wrapper for RecursiveASTVisitor, so I'd expect no problems with multithreading. This definitely needs to be confirmed though by someone who actually knows what they are talking about. :)<br>

Just out of curiosity, what is your use case? Navigating the AST is fast, especially compared to the cost of building the AST. Are you running a huge number of matchers?<br>
</blockquote>
<br></div>
I have a legacy C++ code base which I'm trying to extract useful information out of. For example, a single matcher which matches all method definitions of a particular class takes around 8 seconds on my machine, varying a little with the complexity of the matcher.<br>

<br>
Is the AST kept around for the lifetime of the "ClangTool" object, or is it recreated each time the "run" method is invoked? Some of my matchers depend on information gathered by other matchers  (one matcher gathers method definitions so they can be consumed by when matching the corresponding class declarations). For example:<br>

<br>
MatchCallback cb1, cb2;<br>
MatchFinder finder1<br>
<br>
finder1.addMatcher(m1, &cb1);<br>
finder1.addMatcher(m2, &cb2);<br>
<br>
tool->run(<u></u>newFrontendActionFactory(&<u></u>finder1));<br>
<br>
MatchCallback cb3, cb4;<br>
MatchFinder finder2<br>
<br>
finder2.addMatcher(m3, &cb3);<br>
finder2.addMatcher(m4, &cb4);<br>
<br>
tool->run(<u></u>newFrontendActionFactory(&<u></u>finder2));<br>
<br>
Will this build the AST twice or just once?  Is there any guarantee concerning the order in which the matcher callbacks are invoked?<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
-- <br>
Gábor Kozár -- ShdNx<br>
<a href="mailto:kozargabor@gmail.com" target="_blank">kozargabor@gmail.com</a><br>
On Tue, Sep 24, 2013, at 10:15, Jesper Eskilson wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi,<br>
Are the AST matchers thread safe? I have a bunch of matchers which I<br>
would like to run in separate threads for performance reasons. Is that<br>
expected to work, or am I overly optimistic?<br>
/Jesper<br>
-- <br>
*Jesper Eskilson* /Development Engineer/<br>
IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br></div>
E-mail: <a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a> <mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>> <mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>><div class="im">
<br>
Website: <a href="http://www.iar.com" target="_blank">www.iar.com</a><br>
<<a href="http://www.iar.com" target="_blank">http://www.iar.com</a>> Twitter: <a href="http://www.twitter.com/iarsystems" target="_blank">www.twitter.com/iarsystems</a><br>
<<a href="http://www.twitter.com/iarsystems" target="_blank">http://www.twitter.com/<u></u>iarsystems</a>><br></div>
______________________________<u></u>___________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a> <mailto:<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/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
-- <br>
*Jesper Eskilson* /Development Engineer/<br>
IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
E-mail: <a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a> <mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>> Website: <a href="http://www.iar.com" target="_blank">www.iar.com</a><br>

<<a href="http://www.iar.com" target="_blank">http://www.iar.com</a>> Twitter: <a href="http://www.twitter.com/iarsystems" target="_blank">www.twitter.com/iarsystems</a> <<a href="http://www.twitter.com/iarsystems" target="_blank">http://www.twitter.com/<u></u>iarsystems</a>><br>

______________________________<u></u>_________________<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/<u></u>mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>