Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++20][Modules] Implement include translation.
This addresses [cpp.include]/7 (when encountering #include header-name) If the header identified by the header-name denotes an importable header, it is implementation-defined whether the #include preprocessing directive is instead replaced by an import directive. In this implementation, include translation is performed _only_ for headers in the Global Module fragment, so: ``` module; #include "will-be-translated.h" // IFF the header unit is available. export module M; #include "will-not-be-translated.h" // even if the header unit is available ``` The reasoning is that, in general, includes in the module purview would not be validly translatable (they would have to immediately follow the module decl and without any other intervening decls). Otherwise that would violate the rules on contiguous import directives. This would be quite complex to track in the preprocessor, and for relatively little gain (the user can 'import "will-not-be-translated.h";' instead.) TODO: This is one area where it becomes increasingly difficult to disambiguate clang modules in C++ from C++ standard modules. That needs to be addressed in both the driver and the FE. Differential Revision: https://reviews.llvm.org/D128981
- Loading branch information
Showing
5 changed files
with
266 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.