使用GCC[復制]獲得C程序的抽象語法樹

[英]Getting the abstract syntax tree of a C program with GCC [duplicate]


This question already has an answer here:

這個問題已經有了答案:

How to get abstract syntax tree of a C program with GCC?

如何用GCC來獲取C程序的抽象語法樹?

I'm trying to automatically insert OpenMP pragmas to the input C program. I need to analyze nested for loops to find dependencies so that I can insert appropriate OpenMP pragmas.

我試圖自動將OpenMP實用程序插入到輸入C程序中。我需要分析嵌套的for循環以找到依賴性,以便插入適當的OpenMP實用程序。

So basically what I want to traverse and analyze the abstract syntax tree of the input C program.

基本上我想要遍歷和分析輸入C程序的抽象語法樹。

How do I achieve this?

我該如何做到這一點?

1 个解决方案

#1


1  

Use clang with -ast-print option, this is the cleanest way to do it.

使用clang與- astm -print選項,這是最干凈的方法。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/02/28/7301e93d9681fe911cf89ac37cad68cb.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com