[cfe-dev] Compile Server?

David Claughton dave at eclecticdave.com
Mon Jan 17 16:02:37 PST 2011


On 17/01/11 18:15, Douglas Gregor wrote:
> 
> As Reid notes, C/C++ make caching of intermediate results really
> tricky. However, you can perform some optimizations, e.g., detecting
> common sequences of prefix headers and automatically generating
> precompiled headers for them.

Yes, this is the sort of thing I had in mind, start with automatically
creating a PCH file for all the headers in the first source file and
check whether it can be used for the next.  There is, I think, a tiny
bit of flexibility in that if the second source file only includes the
first few headers (in the same order) than it should be OK to use the
first part of the PCH.  I think that should cover quite a lot of common
cases.

Once that is in place, it might then be possible to try to go further.
I've read the gcc-compile-server paper referenced in the original thread
and I can see that navigating the dependencies problem is fraught with
difficulties - however it might be possible to identify some limited
cases where it might be safe to proceed and sort of nibble at the
problem from the edges?  If nothing else I will probably learn a lot
from trying, which is almost never a bad thing ;-)

> I think one of the other goals of a compiler server is to support
> interactive clients, such as an IDE. So, it's not that we have a list
> of compile jobs provided in advance: we have requests coming in,
> typically for some smallish set of files that are constantly
> changing, and we need to return results quickly.

Hmm, interesting.  If the IDE were written in C++ it would probably be
more efficient for it to call the libraries directly - but I can see the
advantages for something like Eclipse.

Cheers,

	David.





More information about the cfe-dev mailing list