[cfe-dev] Getting started with walking the AST

Adam Smalin acidzombie24 at gmail.com
Tue Jun 14 00:37:31 PDT 2011


Note: I am using LLVM and CLANG 2.9

I want to start with someone basic. Like printing out all the function or
class names. Or maybe all variables in a struct that is a type int. Anyways
to get started i look at `llvm/tools/clang/examples`. I see
clang-interpreter, in main.cpp theres nothing including AST and it seems
like not what i want. The example PrintFunctionNames looks exactly what i
want but theres no main(). I read it and it seems like HandleTopLevelDecl is
the key function. I see instructions on how to use this on linux/mac but i
rather do it on windows since i like debugging in VS.

Moving on i looked at clang-wpa.cpp which seems to kickstart an
analyzer/debugger/something but i cant build it! I have missing files and
such. One such error is "error C2039: 'LAST_INHERITABLE' : is not a member
of 'clang::attr'". Others i mention in a post here
http://stackoverflow.com/questions/6326453/ Is the examples outdated? i am
afraid to grab the main branch for more troubles. Does the example work on
linux? and does it work on 2.9 tag or do i need to use a branch? (which?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110614/441f0005/attachment.html>


More information about the cfe-dev mailing list