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

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Oct 15 11:57:24 PDT 2010


On Oct 15, 2010, at 3:37 AM, Tor Arne Vestbø wrote:

> Add Clang driver-support for directory-style precompiled headers
> 
> When passed -include foo we will check if foo.pch is a directory,
> and if so try to look up a precompiled header matching the current
> input language in that directory.
> 
> GCC will actually search every file in this directory, regardless of
> naming, and choose the first one that matches the language.
> 
> ---
> 
> Comments? Is it okey to do this kind of simple transparent GCC-compatibility-trick or do we have to do what GCC does and actually parse each header in that directory and check if it's valid for the language?

Hi Tor,

This less about supporting directory-style precompiled headers and more about supporting Qt's build system.
In that context, although it doesn't disrupt anything, it's a bit "hacky". IMHO the "right" thing is to add a clang-specific mkspec to Qt, like this:

QMAKE_CXXFLAGS_USE_PRECOMPILE += -include-pch ${QMAKE_PCH_OUTPUT_BASE}.pch/c++

and ideally fix qmake/generators/unix/unixmake.cpp and/or qmake/generators/unix/unixmake2.cpp to pass QMAKE_PCH_OUTPUT and transform the above to:

QMAKE_CXXFLAGS_USE_PRECOMPILE += -include-pch ${QMAKE_PCH_OUTPUT}

Thoughts?

-Argyrios

> 
> Side-note about the code: There's a condition where we "Ignore the PCH if not first on command line and emit warning.", but we don't actually ignore the argument, it's claimed and rendered as a normal -include. Is this intentional? In my case I chose to actually ignore the whole argument, does that makes sense?
> 
> Thanks!
> 
> Tor Arne
> 
>  include/clang/Basic/DiagnosticDriverKinds.td |    2 ++
>  lib/Driver/Tools.cpp                         |   10 ++++++++++
>  test/Driver/pch.c                            |   25 +++++++++++++++++++++++++
>  test/Driver/pth.c                            |   12 ++++++++++++
>  4 files changed, 49 insertions(+), 0 deletions(-)
>  create mode 100644 test/Driver/pch.c
> 
> 
> 
> <0001-Add-Clang-driver-support-for-directory-style-precomp.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list