[PATCH] D121095: [C++20][Modules][HU 1/5] Introduce header units as a module type.
Iain Sandoe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 7 04:39:11 PST 2022
iains created this revision.
Herald added subscribers: dexonsmith, dang.
Herald added a project: All.
iains added reviewers: rsmith, urnathan, ChuanqiXu.
iains added a subscriber: clang-modules.
iains edited the summary of this revision.
iains added a comment.
iains published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This is a small patch set that implements the initial front end changes to support C++20 importable modules.
A second path series will follow that makes the driver changes to drive the fronted support.
This implementation makes the user-facing names, command line options and behaviour match the existing GCC implementation. There is no apparent engineering reason for divergence and this strategy minimises user learning curves and tooling differences.
1/5 - introduces the module type and build actions to compile them
2/5 - allows the user to specify that a header unit should be found from either the user or system search paths in force. In particular this avoids the user having to know the install path for system headers.
3/5 - handles emitting macros that are live at the end of the header unit TU, as required.
4/5 - handles pre-processed header unit sources
5/5 - introduces "-fdirectives-only" that can be combined with -E to produce pre-processor output that can be consumed as a second job to build an importable header (it can also be used to provide a scannable preprocesed file that has actioned any directives).
iains added a comment.
please see first comment for a description of the patch series.
This is the first in a series of patches that introduce C++20 importable
header units.
These differ from clang header modules in that:
(a) they are identifiable by an internal name
(b) they represent the top level source for a single header - although that one might include or import other headers.
We name importable header units with the path by which they are specified
(although that need not be the absolute path for the file).
So "foo/bar.h" would have a name "foo/bar.h". Header units are made a
separate module type so that we can deal with diagnosing places where they
are permitted but a named module is not.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D121095
Files:
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangOptions.h
clang/include/clang/Basic/Module.h
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/FrontendActions.h
clang/include/clang/Frontend/FrontendOptions.h
clang/include/clang/Lex/ModuleMap.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Decl.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/Frontend/FrontendActions.cpp
clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
clang/lib/Lex/ModuleMap.cpp
clang/lib/Parse/Parser.cpp
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaModule.cpp
clang/test/Modules/cxx20-hu-01.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121095.413394.patch
Type: text/x-patch
Size: 17705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220307/26491f0d/attachment-0001.bin>
More information about the cfe-commits
mailing list