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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jan 29 08:16:32 PST 2014


> One thing I'd be curious about:
> What would be the downside of using the parent clang *just* as crash
> reporter - and push all driver logic into the spawned process. The parent
> clang would then forward all command line arguments literally, and then just
> sit there, waiting for the crash, and if there is a crash scrap up all it
> needs for the bug report.
> That way, we could easily turn off forking and have equivalent behavior
> minus crash reporting.
> Is there a downside to that that I'm missing (apart from the time needed to
> implement it)?

When running something like "clang foo.c -o bar", some things are
required by both the linker an the compiler. PIC comes to mind, but I
am sure there is more. In these cases, I is probably better to avoid
the duplication and have the driver compute the answer and just pass
it down.

But I mostly agree that we seem to process more flags in the driver
than we need to (and not that advantage of that in the compiler).

This is mostly orthogonal the fork issue. We can cleanup the driver to
compiler frontend interface regardless of it being a different process
or not.

Cheers,
Rafael



More information about the cfe-dev mailing list