[cfe-commits] [PATCH] Add Clang driver-support for directory-style precompiled headers

Sebastian Redl sebastian.redl at getdesigned.at
Fri Oct 15 04:26:04 PDT 2010


On 15.10.2010 12:37, Tor Arne Vestbø wrote:
> Add Clang driver-support for directory-style precompiled headers
>
Very nice. A comment below.

> diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
> index 31f9c08..5f0bbb7 100644
> --- a/lib/Driver/Tools.cpp
> +++ b/lib/Driver/Tools.cpp
> @@ -260,6 +260,16 @@ void Clang::AddPreprocessingOptions(const Driver&D,
>               CmdArgs.push_back("-include-pch");
>             else
>               CmdArgs.push_back("-include-pth");
> +          if (P.isDirectory()) {
> +            // Expect to find a precompiled header matching the current input type
> +            P.appendComponent(types::getTypeName(Inputs[0].getType()));
> +            if (!P.exists()) {
> +              D.Diag(clang::diag::warn_drv_pch_missing_language)
> +<<  A->getAsString(Args)<<  P.str()
> +<<  types::getTypeName(Inputs[0].getType());
> +              continue;
> +            }
> +          }
>             CmdArgs.push_back(Args.MakeArgString(P.str()));
>             continue;
>           } else {
>    
Shouldn't we check for the existence of the file first, and only pass 
-include-pch options if it does exist?

Sebastian




More information about the cfe-commits mailing list