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

dblaikie at gmail.com dblaikie at gmail.com
Tue Dec 31 15:24:23 PST 2013

On Monday, December 30, 2013 2:40:30 PM, Sean Silva <silvas at purdue.edu>

On Mon, Dec 30, 2013 at 9:40 AM, dblaikie@
<dblaikie at gmail.com>gmail.com<dblaikie at gmail.com><
dblaikie@ <dblaikie at gmail.com>gmail.com <dblaikie at gmail.com>> wrote:

 On Sun Dec 29 2013 at 10:25:19 AM, Schlottke, Michael
<m.schlottke<m.schlottke at fz-juelich.de>
@ <m.schlottke at fz-juelich.de>fz
<m.schlottke at fz-juelich.de>-<m.schlottke at fz-juelich.de>
juelich.de <m.schlottke at fz-juelich.de>> wrote:

 Hi David,

Thanks for the fast reply.

>From your description I infer that clang-fixit is a tool for enforcing a
certain naming convention, rather than changing specific names, or did I
misunderstand you?

  That's correct - but it has the same challenges in terms of resizing
names, etc.

However, maybe it could be a place for me to start looking for ideas... The
only reference I found to clang-fixit is
but nothing in the llvm or clang/extra repository. Could you tell me where
I can find more information on it?

  Hmm, perhaps it hasn't really been started yet. Sorry for the red herring.

 Do you maybe mean clang-tidy? It's in clang-tools-extra last I checked

Indeed I did. Thanks for the correction!

-- Sean Silva

I would guess clang-migrate would be the next best tool to look at. It does
various code changes and deals with reformatting the resulting code, etc.

- David



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

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

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<m.schlottke at fz-juelich.de>
@ <m.schlottke at fz-juelich.de>fz
<m.schlottke at fz-juelich.de>-<m.schlottke at fz-juelich.de>
juelich.de <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
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
Mail: m.schlottke <m.schlottke at fz-juelich.de>@
<m.schlottke at fz-juelich.de>fz<m.schlottke at fz-juelich.de>
- <m.schlottke at fz-juelich.de>juelich.de <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
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

cfe-dev mailing list
cfe- <cfe-dev at cs.uiuc.edu>dev <cfe-dev at cs.uiuc.edu>@ <cfe-dev at cs.uiuc.edu>
cs.uiuc.edu <cfe-dev at cs.uiuc.edu>
http:// <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>lists.cs.uiuc.edu<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>
/mailman/ <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>listinfo<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>
/cfe- <http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>dev<http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131231/76b51b18/attachment.html>

More information about the cfe-dev mailing list