Boost logo

Boost :

Subject: Re: [boost] Scalpel: a Spirit&Wave-powered C++ source code analysis library
From: Doug Gregor (doug.gregor_at_[hidden])
Date: 2010-09-08 12:46:46


I'm sounding too much like an advertisement, so I'll try to batch
those replies a bit more...

On Wed, Sep 8, 2010 at 3:20 AM, Dmitry Goncharov <dgoncharov_at_[hidden]> wrote:
>
>>   On 09/07/2010 06:30 AM, Florian Goujeon wrote:
>> So, any idea?
>
> You could use your library to build a replacement for ctags (ctags.sf.net).
>
> ctags supports over 40 languages and uses regexes to do so.
> ctags hardly copes with overloading. The user is supposed to choose among overloads.
>
> A compiler based tool should be able to do a lot better. There is a need for such an open source tool in the unix world.

Yes, absolutely!

To this end, Clang provides a simplified C API with detailed
cross-referencing information of the form needed for this task,
mapping between the source code (file/line/column) and the associated
AST (expressions, statements, declarations, types). We can map the "f"
in "f(x)" back to the function selected by overload resolution, or map
the "+" in "x + y" to the overloaded operator it uses. Building
something ctags-like from that API should be easy. The Clang C API is
documented here:

  http://clang.llvm.org/doxygen/group__CINDEX.html

On Wed, Sep 8, 2010 at 12:38 AM, Ryo IGARASHI <rigarash_at_[hidden]> wrote:
> FYI, there is an GCCSense project(http://cx4a.org/software/gccsense/)
> to use with emacs/vim for translation unit aware code completion.

Clang provides code completion through the C API:

  http://clang.llvm.org/doxygen/group__CINDEX__CODE__COMPLET.html

and via the command line. Integration with vim/Emacs should be simple;
I hacked up the first Emacs mode for it in a few hours.

On Tue, Sep 7, 2010 at 8:09 PM, Gottlob Frege <gottlobfrege_at_[hidden]> wrote:
> Or red underline, like a spell checker.  And blue underline like MS
> Word for "grammar" (syntax) errors. You get the idea.  Might as well
> do real spell checking (against dictionary and code identifiers) in
> the comments as well...

It turns out that spell-checking is also great for error recovery:

  http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html#spell_checker

  - Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk