<div class="gmail_quote">On Sun, Jun 27, 2010 at 10:17 PM, Yang Ye <span dir="ltr"><<a href="mailto:yeyangever@gmail.com">yeyangever@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello everyone,<br>
<br>
This is Yang Ye, a new researcher working on Clang. I want to use<br>
clang to print out the abstract syntax tree in a human readable, not<br>
getting the binary bytecode one.<br>
Can anyone show me how to use the API to do it?<br></blockquote><div><br></div><div>Currently you can use 'clang -cc1 -ast-dump' to get this. The code is driven from ASTPrinter defined here: <a href="http://clang.llvm.org/doxygen/ASTConsumers_8cpp_source.html#l00034">http://clang.llvm.org/doxygen/ASTConsumers_8cpp_source.html#l00034</a></div>
<div><br></div><div>However, if you're interested in this type of walk, I'd suggest you consider the RecursiveASTVisitor: <a href="http://clang.llvm.org/doxygen/classclang_1_1RecursiveASTVisitor.html">http://clang.llvm.org/doxygen/classclang_1_1RecursiveASTVisitor.html</a></div>
<div><br></div><div>It's not complete yet, so it misses a few parts of the AST, but it's being actively developed by several folks who are interested in similar walks of the AST.</div><div><br></div><div>-Chandler</div>
</div>