[cfe-dev] Why clang needs to fork into itself?

Yuri yuri at rawbw.com
Mon Jan 27 18:17:37 PST 2014


On 01/27/2014 17:38, Richard Smith wrote:
> I don't think the reasons why we spawn another binary have really been
> captured in this thread. The biggest reason is that the clang driver
> accepts multiple files to compile:
>
>     clang foo.c bar.c baz.c -o thing
>
> ... and runs one compile process for each source file (and in this case,
> one link process for the binary). Crash recovery is just a nice side-effect
> of having a separate driver and frontend. The main benefit is that we get a
> consistent execution model regardless of the number of files passed to the
> driver.

But this also is not necessary to do. clang can just go through them 
sequentially in the same process. Now it forks itself for each of them 
one by one sequentially.

Yuri



More information about the cfe-dev mailing list