<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Jan 28, 2014, at 12:15 PM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 28, 2014 at 9:11 PM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com" target="_blank">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5">On Jan 28, 2014, at 12:08 PM, Manuel Klimek <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:<br>
<div><br><blockquote type="cite"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">On Tue, Jan 28, 2014 at 2:38 AM, Richard Smith<span> </span></span><span dir="ltr" style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><<a href="mailto:metafoo@gmail.com" target="_blank">metafoo@gmail.com</a>></span><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"> </span><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">wrote:</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<blockquote class="gmail_quote" style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div>On Mon Jan 27 2014 at 4:51:40 PM, Yuri <<a href="mailto:yuri@rawbw.com" target="_blank">yuri@rawbw.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 01/27/2014 16:37, Jean-Daniel Dupas wrote:<br>> If you want to debug/profile clang, you can invoke it directly with the -cc1 flag, and passing the right arguments.<br>><br>> To get the full command line used to invoke the real compilation process, you can use the -### argument:<br>
><br>> clang -### -c -emit-llvm c.cpp<br>><br>> For the record, in the early days, the clang driver was a separate binary that used to invoke the compiler (which was called ccc IIRC).<br>> Some time ago, the driver and the compiler were merged into a single clang binary, but it continue to work the same way it used to do. That explains why it executes itself.<br>
<br>I see.<br>So I wrote up my proposal to make this opt-in:<br><a href="http://llvm.org/bugs/show_bug.cgi?id=18638" target="_blank">http://llvm.org/bugs/show_bug.<u></u>cgi?id=18638</a></blockquote><div><br></div></div><div>
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:</div><div><br></div><div>   clang foo.c bar.c baz.c -o thing</div>
<div><br></div><div>... 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.</div>
</blockquote><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
<br></div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
But nowadays with modules we also have in-process compilation steps of dependent modules without going through the whole driver enchilada, so is this becoming an obsolete argument?</div></blockquote></div><br></div></div>
<div>Clang forking itself remains quite useful for getting test cases for crashers.  If the forked clang crashes the parent clang process tries to generate a preprocessed source to serve as a test case.  We have found this to be invaluable for users to file useful test cases.</div>
</div></blockquote></div><br></div><div class="gmail_extra">Will that still work if the crash comes from a dependent module?</div></div>
</blockquote></div><br><div>I’m not 100% certain it will cover all cases, but I have seen in the case of modules that the generated preprocessed file contains @import lines for importing modules.</div></body></html>