[cfe-dev] LibTooling vs. LibClang+Python for simple refactoring

Schlottke, Michael m.schlottke at fz-juelich.de
Sun Dec 29 10:35:01 PST 2013

Hi Manuel,

Thanks for your fast answer.

>From what you're saying it sounds like LibTooling is indeed the place for me to start. I don't want to reinvent the wheel by doing stuff with LibClang for which it wasn't made, so maybe I have to swallow the red pill and dig into LibTooling. I will, however, take a final look at LibClang - if the only parts that are missing are the rewriting functions, doing it in Python might still deliver first results faster...

Having said that, do you know of any efforts to have LibTooling bindings for Python as well? From the tools documentation website I understood that since LibTooling has not (yet?) reached a stable interface, no one bothered to start with one, but you never know before you ask ;-)



-------- Ursprüngliche Nachricht --------
Von: Manuel Klimek <klimek at google.com>
An: dblaikie at gmail.com
Cc: "Schlottke, Michael" <m.schlottke at fz-juelich.de>,cfe-dev Developers <cfe-dev at cs.uiuc.edu>,Daniel Jasper <djasper at google.com>
Betreff: Re: [cfe-dev] LibTooling vs. LibClang+Python for simple refactoring

As David says, LibTooling was made for this task - I myself don't have a deep understanding of how easy those things would be to do with libclang - you might need to expose some interfaces that are not exposed yet (that might be a great contribution to the clang community if you happen to try that route ;)


On Sun, Dec 29, 2013 at 5:52 PM, dblaikie at gmail.com<mailto:dblaikie at gmail.com> <dblaikie at gmail.com<mailto:dblaikie at gmail.com>> wrote:
Tooling, specifically the clang-fixit till is one place sheet efforts are being made to apply these kinds of refractoriness (specifically clang-fixit would apply predefined naming convention rules, rather than user specified renaming).

One of the things that tooling might help you with would be the necessary reformatting (clang-format) and build/source discovery.

On Sunday, December 29, 2013 3:49:06 AM, Schlottke, Michael <m.schlottke at fz-juelich.de<mailto:m.schlottke at fz-juelich.de>> wrote:

Hi everyone,

For our research group, I need to get started with some relatively simple refactoring tasks in a modestly complex C++ project. The goal is to have a tool that (in the beginning) is good for at least two things:
- renaming member variables/methods
- replacing member variable access by getters/setters

After the extremely positive experiences I've had with clang (and since the IDE tools I tried failed for our project), I'd like to utilize the clang infrastructure for this task. However, in the very beginning I already face the problem of where I should start:

On the one hand, LibTooling seems to be the interface of choice when it comes to refactoring code (it's one of the canonical examples on http://<http://clang.llvm.org/docs/Tooling.html>clang.llvm.org<http://clang.llvm.org/docs/Tooling.html>/docs/<http://clang.llvm.org/docs/Tooling.html>Tooling.html<http://clang.llvm.org/docs/Tooling.html>). On the other hand libclang seems to be easier to use, has Python bindings, and from the outset looks like it could be already sufficient for the task at hand.

Do you have any experience/recommendations for which library is the one to use in this case?



Michael Schlottke

SimLab Highly Scalable Fluids & Solids Engineering
Jülich Supercomputing Centre (JSC)
Forschungszentrum Jülich GmbH
52425 Jülich

Phone: +49 (2461) 61 2326<tel:%2B49%20%282461%29%2061%202326>
Mail: m.schlottke<mailto:m.schlottke at fz-juelich.de>@<mailto:m.schlottke at fz-juelich.de>fz<mailto:m.schlottke at fz-juelich.de>-<mailto:m.schlottke at fz-juelich.de>juelich.de<mailto:m.schlottke at fz-juelich.de>
Web: http://<http://www.fz-juelich.de/jsc>www.fz<http://www.fz-juelich.de/jsc>-<http://www.fz-juelich.de/jsc>juelich.de<http://www.fz-juelich.de/jsc>/<http://www.fz-juelich.de/jsc>jsc<http://www.fz-juelich.de/jsc>

Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131229/2fe63343/attachment.html>

More information about the cfe-dev mailing list