Skip to content

Add support for C++ modules#411

Merged
asottile merged 1 commit into
pre-commit:mainfrom
perryjiang:cppmodules
Sep 11, 2023
Merged

Add support for C++ modules#411
asottile merged 1 commit into
pre-commit:mainfrom
perryjiang:cppmodules

Conversation

@perryjiang

@perryjiang perryjiang commented Sep 9, 2023

Copy link
Copy Markdown
Contributor

Clang: https://clang.llvm.org/docs/StandardCPlusPlusModules.html

The file name of an importable module unit should end with .cppm (or .ccm, .cxxm, .c++m). The file name of a module implementation unit should end with .cpp (or .cc, .cxx, .c++).

I added support for the c++ file extension too.

Also, clang-format: https://github.com/llvm/llvm-project/blob/676629598595605dd673eeca9036609d13b6e193/clang/tools/clang-format/git-clang-format#L92

MSVC: https://devblogs.microsoft.com/cppblog/a-tour-of-cpp-modules-in-visual-studio/

C++20 introduces new keywords to define and consume modules and Visual Studio uses a new file type “.ixx” to define a module’s interface.

I couldn't find an authoritative source for GCC. https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Modules.html doesn't say anything.

@asottile asottile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile asottile merged commit cc7bf02 into pre-commit:main Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants