[cfe-dev] how to get AST content from CXCursor?

Jacob Carlborg via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 30 13:20:11 PDT 2018

On 2018-10-30 05:15, Lou Wynn via cfe-dev wrote:
> That's what I guessed. But my purpose is doing source-to-source 
> translation. I'm not sure if I should use libclang and your previously 
> suggested method to do it, or use libTooling to directly get AST nodes. 
> To me, the second method seems easier to get the content of a node.
> Any suggestions? Which way do you prefer if you were translating the 
> source to another language?

I have a a tool that converts C and Objective-C headers to D modules [1] 
using libclang. It's written in D so libclang is the best choice for me. 
I suggest you have a look at this page [2] which compares the different 
ways of using Clang when building tools.

[1] http://github.com/jacob-carlborg/dstep
[2] https://clang.llvm.org/docs/Tooling.html

/Jacob Carlborg

More information about the cfe-dev mailing list