[cfe-dev] Mapping Clang C code AST to Code

Douglas Gregor dgregor at apple.com
Fri Jun 15 13:19:17 PDT 2012


On Jun 15, 2012, at 11:58 AM, Carlos Andrade <carlosviansi at gmail.com> wrote:

> I am interested on seeing this sort of information on the tree. Do you believe it would be hard to implement this given what information the other parts that already exist get the tree? I could contribute to it. Few pointers where to look into the source would be very appreciated.
> 
> Specifically I want to see code lines and the values of operators etc. 

All of the information is in the tree. It's simply the Decl and Stmt printers that are not complete. Both live in the AST library. 

  - Doug

> Best,
> 
> --
> Carlos Andrade
> http://carlosandrade.co
> 
> Sent from my iPhone. 
> 
> On 15/06/2012, at 10:20, Douglas Gregor <dgregor at apple.com> wrote:
> 
>> 
>> On Jun 13, 2012, at 9:28 AM, Carlos Andrade wrote:
>> 
>>> Hi,
>>> 
>>> I have been trying without much success figuring a way to map the -ast-view from Clang cc1 option to code, and --ast-dump-XML as well. Is this possible? If so, how?
>>> 
>>> Please let me know if this is the wrong list to post this..
>> 
>> 
>> Neither of these is directly possible. The AST-printing facilities do not print well-formed code, and the XML dumps are both incomplete and not necessarily well structured for anything other than debugging the compiler. That's why both options are hidden behind the compiler's internal -cc1 interface.
>> 
>> What are you actually trying to accomplish?
>> 
>>   - Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120615/436a2a08/attachment.html>


More information about the cfe-dev mailing list