[cfe-dev] RE : AST Transformation

Konstantin Tokarev annulen at yandex.ru
Thu Mar 31 01:51:27 PDT 2011



31.03.2011, 11:24, "Ruch Grégory" <gregory.ruch at heig-vd.ch>:
> But the question is more technical about Clang. Can we just implement AST transformation plugin and let the normal execution of Clang to build the executable ? I've read that pretty-print do not garantee to get reparsable code, therefore I throught that it will be better to build directly the executable.

I'd like to join this part of question (but not in obfuscation aspect).

AFAIU, plugins like PrintFunctionNames can only replace Clang AST 
transformation, but not add one to compilation process.

More specifically, I'm trying to create C++ frontend explicitly supporting
features of Qt Framework. Goal is to provide additional compile-time
diagnostics and optimizations. To achieve it, I'd like to interact with AST
when it is constructed (via custom ASTConsumer or maybe PPCallbacks,
or both), then perform some transformations of this AST, and return it back
into compilation process. 

It would be great if it could be done in a plugin, because otherwise I'm afraid
that I'll need to fork Driver and introduce substantial modifications to it's code.

Any suggestions?

-- 
Regards,
Konstantin



More information about the cfe-dev mailing list