[cfe-dev] Traversing AST node by node
Frederico Araujo
araujof at gmail.com
Mon Aug 10 21:56:36 PDT 2015
Hi,
Yes! Clang provides a really nice API to achieve this.
You can use Clang RecursiveASTVisitor to traverse the AST:
http://clang.llvm.org/docs/RAVFrontendAction.html
or you can match on specific nodes using AST matchers:
http://clang.llvm.org/docs/LibASTMatchersTutorial.html
With Clang libtooling, you can compile your program into a standalone tool
that gets as input the source code to be analyzed.
Hope it helps,
-Fred
On Tue, Aug 11, 2015 at 12:22 AM, Hashan Buddhika Narangodage <
hashanbn at gmail.com> wrote:
> Hi all,
> I'm currently doing a project that needs me to analyse the AST of source
> codes from top to bottom without traversing specific parts of the AST. I
> want to simple traverse each and every node in the tree structure and
> collect information. Is there an easy way to get this done ?
>
> I'm new to clang so any help would be greatly appreciated.
>
> Thanks in advance,
> Cheers!!!
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150811/097cfab7/attachment.html>
More information about the cfe-dev
mailing list