[cfe-dev] Getting involved with Clang refactoring

Douglas Gregor dgregor at apple.com
Mon May 21 10:56:51 PDT 2012



Sent from my iPhone

On May 19, 2012, at 4:14 PM, Manuel Klimek <klimek at google.com> wrote:

> On Fri, May 18, 2012 at 5:21 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> 
>> On May 18, 2012, at 12:11 AM, David Wood <dswood at gmail.com> wrote:
>> 
>>> Greetings,
>>> 
>>> I just attended Chandler Carruth's talk at C++ Now about using clang to develop refactoring tools.  As they say on the internets "Your ideas intrigue me and I would like to subscribe to your newsletter."
>>> 
>>> I believe that refactoring tools can be groundbreaking for C++ and would like to contribute.  I'm particularly interested in getting the tools hooked into IDEs (many years ago I worked on a refactoring plugin for JBuilder), but it sounds like there's lots of work to be done before that.  How can I get started, and what most needs to be worked on?
>> 
>> Welcome!
>> 
>> Arnaud's links point at the tooling infrastructure, which is intended for building standalone refactoring and source-based tools.
>> 
>> For IDE-centric tools, libclang
>> 
>>        http://clang.llvm.org/doxygen/group__CINDEX.html
>> 
>> is a C interface to Clang that focuses on the things that IDEs like to do: syntax highlighting, indexing, code completion, finding all of the references to a given declaration within a file, finding out what your cursor is pointing to, etc. I gave an introductory talk on libclang at the 2010 LLVM Developer Meeting which might be helpful:
>> 
>>        http://llvm.org/devmtg/2010-11/
>> 
>> If your primary interest is in IDEs, I suggest wiring up libclang to your favorite open-source IDE. There are various Vim and Emacs libclang bindings running around, for example, although I don't know which are best. Personally, I think it would be awesome if we could have easy-to-install, libclang-based packages for vim and emacs that were maintained along with Clang and got all of the new libclang goodness. Once you've played with libclang's integration, I'm sure you'll find something that needs improvement, and we can point you at that code if you don't find it yourself.
>> 
>> If your primary interest is in refactoring, Arnaud's links to tooling are a good place to start, because it's starting to collect the pieces needed to make refactoring easier.
> 
> And while I'm at it. One thing that might be interesting for a
> contribution is getting the compilation database support up for
> libclang (not sure how Doug thinks about this, but I'm sure he'll jump
> in ;) One of the problems I have with the libclang plugins I know is
> that I need to specify "one common command line".

That's a good idea. libclang assumes that you have your own compilation database (or similar) and that you use it up feed command lines to libclang, but it would be easier to use libclang if we could just point it at a build or source tree and then feed source files to libclang. 



More information about the cfe-dev mailing list