[cfe-dev] Running ASTMatcher over main file only

Edwin Vane revane at gmail.com
Sat Oct 12 05:51:46 PDT 2013


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.


On Fri, Oct 11, 2013 at 11:50 AM, Kirk Fertitta
<kirk at pacificmindworks.com>wrote:

>  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.****
>
> ** **
>
> Any advice is much appreciated.****
>
> ** **
>
> Kirk Fertitta****
>
> Chief Technical Officer****
>
> Pacific MindWorks, Inc.****
>
> ph:  858-207-6198****
>
> fax: 858-521-1385****
>
> ** **
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>


-- 
Edwin V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131012/4e2e7262/attachment.html>


More information about the cfe-dev mailing list