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

Lou Wynn via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 30 20:35:38 PDT 2018


My first choice was using libClang after reading the document, but when 
I realized that the limitation of libClang--unable to get the content of 
a node easily, my preference shifts to using libTooling.

Love,
Lou

On 10/31/18 4:20 AM, Jacob Carlborg via cfe-dev wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181031/f8860f1d/attachment.html>


More information about the cfe-dev mailing list