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?
I'm not aware of anything very useful at this point. The existing tutorials
that can be found mostly say how to create a plugin itself, but not much
more. Since I've already created a plugin for LO, now "writing a plugin" in
LO actually means adding another class with new functionality to the one LO
plugin, so what is needed now is documentation on the internal Clang API that
is used for writing the functionality.
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.
--
Lubos Lunak
l.lunak@suse.cz
Context
Re: replacing OUString::valueOf(static_cast<sal_Int32>) ?? · Stephan Bergmann
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.