[cfe-dev] source code database

Bruce Stephens bruce.r.stephens at gmail.com
Wed Feb 29 03:13:39 PST 2012


Nico Weber <thakis-F7+t8E8rja9g9hUCZPvPmw at public.gmane.org> writes:

> clang should support much of what you ask for.
>
> DXR ( https://wiki.mozilla.org/DXR ) is an existing attempt to use
> clang to build a program database. https://github.com/nico/complete is
> some old hack from me that does the same in worse - but since there's
> a lot less code, maybe it's easier for a first look (relevant file:
> https://github.com/nico/complete/blob/master/server/complete_plugin.cc).

dxr-index.cpp is ~600 lines, so it's not enormous. It seems non-trivial
to get everything set up. Easy enough to build, though.

(Interestingly it's a clang plugin rather than a standalone using
libclang. (As is include-what-you-use.)

I wonder if that's a trend: that while it seems attractive to build a
standalone against a library with a reasonably stable and documented C
API, in practice it's easier to build a plugin because that lets you use
a richer set of classes and (likely more interesting?) makes it easier
to plug in to existing build systems, so it'll be easier for people to
use in their own projects.)

[...]




More information about the cfe-dev mailing list