Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


2013/1/11 Lubos Lunak <l.lunak@suse.cz>

On Friday 11 of January 2013, Jean-Noël Rouvignac wrote:
2013/1/10 Lubos Lunak <l.lunak@suse.cz>

 > > Unless all you want to convert is only places which do the
explicit

cast, this will need a (fairly simple) Clang plugin.

Sure, if you feel like writing one.

 Actually, I'd prefer to write a howto about that first, whenever I get
to doing that, so that I don't have to write every single plugin. Such
a
plugin
will be still much simpler than a regexp or any other way.

Please do, I would be interested in that.
Maybe you already have some URLs to share on this subject?

That API is documented at http://clang.llvm.org/doxygen/ , but I
understand
that throwing that at somebody unfamiliar with it must be scaring (hint:
the
most commonly needed is the class hiearchy starting from clang::Stmt, as
those are classes representing the program in the AST). I myself actually
find it easier to read directly doxygen docs in the includes, mostly
Decl*.h
Expr*.h Stmt*.h in include/clang/AST/ . The API is however rather intuitive
and straightforward, once one gets into it. And finding out how a
particular
piece of code is represented in the AST is a matter of compiling it
with 'clang++ -Xclang -ast-dump' and matching the output to Clang classes.

 If you want to give it a try now, look under compilerplugins/ in the LO
sources.


I don't find this more intimidating than Eclipse's documentation for
"org.eclipse.cdt.core.dom.ast.cpp" (Eclipse CDT's AST parser for C++) or
"org.eclipse.jdt.core.dom" (Eclipse JDT's AST parser for Java). Only clang
doc is harder to go through but it has nice graphics :).

I might take a look at this.
Thanks for sharing this info.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.