[cfe-dev] collecting source code information
dominik.grewe at gmail.com
Thu Jun 24 12:19:02 CDT 2010
I'd like to write a program that collects statistics of OpenCL kernels. Examples
are the number of arithmetic operations, number and types of variables, etc. In
the future I'd also like to do some static analysis, for example to try and
derive memory access patterns.
I'm new to Clang, so I'm not quite sure how to go about this... It seems like
the RecursiveASTVisitor class could be a good start, as it allows you to
traverse the AST. Overloading VisitStmt() for example would allow me to count
the number of arithmetic expressions, right?
Unfortunately I can't figure out how to start the tree traversal. What is it
that I need to pass my visitor class in order to traverse the whole file or a
Are there any examples that show a usage of RecursiveASTVisitor?
More information about the cfe-dev