[C++20][Modules][Driver][HU 2/N] Add fmodule-header, fmodule-header=
authorIain Sandoe <iain@sandoe.co.uk>
Thu, 20 Aug 2020 15:18:57 +0000 (16:18 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Fri, 22 Apr 2022 13:14:19 +0000 (14:14 +0100)
commit4c4ff004a2702b9b7538efd569bb621a5efac8f3
treea025e45a568967d52ccae1bd8af13b1af032292e
parentfc760c026058aa347b5aa16b548995e89ffe8d31
[C++20][Modules][Driver][HU 2/N] Add fmodule-header, fmodule-header=

These command-line flags are alternates to providing the -x
c++-*-header indicators that we are building a header unit.

Act on fmodule-header= for headers on the c/l:

If we have x.hh -fmodule-header, then we should treat that header
as a header unit input (equivalent to -xc++-header-unit-header x.hh).

Likewise, for fmodule-header={user,system} the source should be now
recognised as a header unit input (since this can affect the job list
that we need).

It's not practical to recognise a header without any suffix so
-fmodule-header=system foo isn't going to happen. Although
-fmodule-header=system foo.hh will work OK.  However we can make it
work if the user indicates that the item without a suffix is a valid
header. (so -fmodule-header=system -xc++-header vector)

Differential Revision: https://reviews.llvm.org/D121589
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Driver.h
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
clang/test/Driver/cxx20-header-units-02.cpp [new file with mode: 0644]