Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Excerpt:

"Clang can serialize its AST out to disk and read it back into another program, which is useful for whole program analysis.

GCC does not have this. GCC's PCH mechanism (which is just a dump of the compiler memory image) is related, but is architecturally only able to read the dump back into the exact same executable as the one that produced it (it is not a structured format)."

Clang, you had me at 'hello'.

The point I outlined above is just icing on the cake!




GCC can dump its internal representation at almost every stage of the compilation process.

However, it's intended for diagnosing issues in the compilers or plugins ; it's definitely not meant to be used as an interoperable format to be loaded back into a program.

gcc doesn't even provide a way to specify the output path for the dump file (too bad, as reliable AST dumping could enable implementing ast-based-ccache (instead of preprocessed-code-based-ccache, for compilation-caching of preprocessor-less languages)).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: