[cfe-commits] [patch] Add support for -fpredictive-compilation

Nico Weber thakis at chromium.org
Tue Sep 13 14:09:55 PDT 2011


Not moving forward with this, per IRC.

On Mon, Sep 12, 2011 at 9:43 PM, Nico Weber <thakis at chromium.org> wrote:
> Hi,
>
> the attached patch adds support for -fpredictive-compilation, for
> compatibility with Apple gcc 4.2.
>
> With this flag, clang needs an input file name like normally, and uses
> the input file to deduce the language (but -x can override it) and the
> default output filename (but -o can override it). The input filename
> is also used in diagnostic messages, but the actual compiler input is
> read from standard input.
>
> With this patch, Xcode 3.2 can be started with
>
>    /Developer/Applications/Xcode.app/Contents/MacOS/Xcode CC=path/to/clang
>
> and even with predictive compilation enabled (the default), cmd-k and
> friends work correctly. (Xcode uses -fpredictive-compilation for this
> as soon as the user changes a file. Since clang used to ignore this
> flag, clang would compile the file as it exists on disk, while Xcode
> would think that the file that it piped to stdin was built, which
> would lead to error messages that were delayed by one compilation.)
>
> Ok?
>
> (In gcc, -fpredictive-compilation does not read from stdin if
> -fpreprocessed is passed as well, but clang doesn't support
> -fpreprocessed, so that logic is not required.)
>
> Thanks,
> Nico
>




More information about the cfe-commits mailing list