Chandler Carruth: Refactoring C++ with Clang
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about C++ refactoring tools built on Clang, since it shows a practical, working example of the tooling library.
Recommended by 4 people across 4 different months, 2012 to 2016.
What it is
Chandler Carruth's C++Now 2012 talk on the Clang tooling infrastructure for recognizing and transforming C++ patterns. It walks through building a source-to-source tool, including an AST matcher based rename example, that migrates code from an old API to a new one.
What people said
Strong rec David C. Bishop · 2012-12 · Stack Overflow · on “any C/C++ refactoring tool based on libclang? (even simplest "toy example" )”
Google have been working on a tooling library for Clang. In since the 3.2 release [LINK] . It includes a ASTMatchers library so you can just build up a query and don't have to walk the AST. There is a great video talk [this video] on the subject that walks through a simple rename example. (This is from the same guy as the MapReduce talk [LINK] posted above but is newer and more about a simple practical implementation rather than the internal design and enterprise scale stuff Google have going on). The source for that example that renames a method is available in the tooling branch [LINK] . It may be somewhere in the trunk but I can't find it. Also Rename the getDeclAs function to getNodesAs as th
Recommends user2089799 · 2013-02 · Stack Overflow · on “Extending c++ with a new keyword”
I will study the 2, thanks. I saw this video in Youtube - link [this video] , about using clang/LLVM to refactor c++, I'll play with them. Thanks.
Recommends schoetbi · 2014-10 · Stack Overflow · on “Why is Visual C++ lacking refactor functionality?”
Refactoring is not imposible: See here whttp: [this video] But I haven't found a publicly available version of it. See also here: [LINK]
Recommends Nikolay Bobovnikov · 2016-10 · Stack Overflow · on “Is there a working C++ refactoring tool?”
I recommend to try rtags [LINK] if you use emacs and haven't tried it yet (there is also a package [LINK] for vim available). It is a clang based client/server application that indexes C/C++ code, with these features included: go to definition/declaration find all references, go to next/previous rename symbol integration with clang’s “fixits” I decided to give it a try after watching this talk [LINK] which introduced rtags (and emacs) for me. (I have to say that I went this far only after my QtCreator failed to rename some symbols properly, which is a show-stopper for my using this great IDE for now) Besides what is supported by rtags, I also need some additional neat features, including: cr
Cites myWallJSON · 2013-02 · Stack Overflow · on “Are there C++ refactoring patterns implemented as a set of Clang tools?”
So I found that nice video on Clang tooling [this video] ... And could not help but wonder: is there any sample codebase/compiled tooling suite for full project beautification and cleanup (alike C# resharper)? Code formating on project scale such as: extra space at line end, unification of member/class naming, ways of how {} brackets are placed after if etc?