[cfe-dev] Producing compilation databases (was Re: Clang-based indexer and code navigator)
Manuel Klimek
klimek at google.com
Wed Mar 13 09:52:52 PDT 2013
On Tue, Mar 12, 2013 at 11:50 AM, <bruce.r.stephens at gmail.com> wrote:
> Manuel Klimek <klimek-hpIqsD4AKlfQT0dZR+AlfA at public.gmane.org> writes:
>
> > On Tue, Mar 12, 2013 at 11:26 AM,
> > <bruce.r.stephens-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
>
> [...]
>
> >> One possibility (which doesn't apply to DXR, which is a compiler plugin)
> >> is producing a compilation database. Using LD_PRELOAD and stuff feels
> >> yucky, and cmake is (to me) useless (the projects I care about mostly
> >> don't use cmake).
> >>
> >
> > Can you use ninja, which has recently grown the capability to throw out a
> > compilation database?
>
> I don't think so. We mostly use GNU Make, but also jam, scons (for some
> bits of Swift), and bjam (for some boost libraries). Obviously
> potentially we could use some unified (new) build system, but it doesn't
> seem likely in the immediate future. What I have managed to do is get
> DXR working (not trivial, since not all the builds allow overriding
> CC/CXX).
>
> > Can clang dump the relevant information in the right form? Feels like it
> >> ought to be easy for it to do so, and that would surely be a clean way
> >> to do it, presuming a project can be made to build with clang/clang++?
> >> (Maybe it could be folded somehow with scan-build?)
> >>
> >
> > Yes, it could be implemented in clang, but it's harder than doing it
> from a
> > build-aware tool, as you'll need some cross-process synchronization,
> > optimally in a OS-independent way...
>
> I assume because clang might be being run several times in parallel (by
> the build tool)?
>
> That feels fixable, or at least a partial result feels useful enough to
> have even if it would fail if run in parallel: have it write the
> relevant rule for building foo.o to foo.o.json or something. Wouldn't
> that kind of approach work, at least to a first approximation (maybe
> needing paths mangling before combining all the rules or something)?
>
It would most certainly work. Somebody needs to put together a patch, and
send it out :)
Cheers,
/Manuel
>
> [...]
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> 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/20130313/4da21afb/attachment.html>
More information about the cfe-dev
mailing list