[cfe-dev] Designing a clang incremental compiler server
Christopher Jefferson
chris at bubblescope.net
Wed Jun 16 14:57:27 PDT 2010
On 16 Jun 2010, at 19:14, Reid Kleckner wrote:
> Hello cfe-dev,
>
> I'm interning at Google for the summer, and the focus of my internship
> is to improve C++ build times by caching the results of parsing
> headers and persisting the results either on disk or in the memory of
> a persistent compiler server process.
>
> Pre-compiled headers already do this, but they generally only work for
> projects that use the '#include "world.h"' header style. My goal is
> to either improve the existing pre-compiled header support so that
> this restriction can be lifted, or do something else entirely.
>
> I worked with the LLVM JIT last summer, but I'm unfamiliar with
> clang's internals. Therefore, I thought I would throw some starting
> questions out to the clang community.
>
> First and foremost, are people interested in this? I'm pretty sure
> the answer is going to be yes, but I thought I should ask. :)
I have no useful design advice, but I can tell you the major problems that we had trying to make use of precompiled headers in a project where we used g++, to the point where we abandoned it, and also some thoughts.
1) Just getting it to work is good :) We found that g++ was very unstable and often segfaulted on significant projects. It would often crash if we tried to compile a pre-compiled header which itself included a pre-compiled header. Also, it required different precompiled headers for different optimisation settings, which was very difficult to automate.
2) Making it much more automated would be ideal -- I would much prefer it to "just happen" given the appropriate compiler flags, along with checking if headers need recompiling if headers get out of date (maybe too much of a hope?)
3) My source files often start (for example)
#include "myheader1.h"
#include "myheader2.h"
#include <vector>
I would really like to have a system which, for each source file, precompiled all the headers up to the first non-header (and non-define?) token. Obviously share these between sources if possible. While this might require quite a lot of compiling on the first compiling pass, hopefully it will speed up later passes.
Chris
More information about the cfe-dev
mailing list