[PATCH] D120540: [Driver] Enable to use C++20 modules standalone by -fcxx-modules

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 19:49:35 PDT 2022


ChuanqiXu added a subscriber: rsmith.
ChuanqiXu added a comment.

@rsmith told me that the ideal situation would combine C++20 modules and clang modules together in D113391 <https://reviews.llvm.org/D113391>

I think the most important thing here is to get in consensus for the module status. Here might be some helpful questions for the goal:

- Should C++20 modules and Clang modules be exclusive from each other?
  - If yes, we could take the idea ` -fmodules= {clang, c++20, none...} ` and forbid the combination of `-fmodules  -std=c++20`. And we could use variable `Modules` to indicate clang modules and `CPlusPlusModules` to indicate c++20 modules.
- If no, it implies that we could use c++20 modules and clang modules together. So the combination of `-fmodules -std=c++20` or even `-fmodules -fcxxmodules` makes sense. It implies that we could use the grammar of clang module extension or c++20 modules. This is decision from D113391 <https://reviews.llvm.org/D113391>. Here are some further questions:
  - Would it be very hard to implement or maintain?
  - We lack a variable to indicate clang modules only. Currently, we couldn't use `Modules` to indicate clang modules since `Modules` is true if we turned C++20 modules on. `Modules` indicate either clang module or c++20 module is enabled. Or we could think it means the common parts of the two features.

The most important technical question might be `Would it be very hard to implement or maintain?`. From my experience, I think it is implementable. But I **feel** it is not easy to maintain. We don't have the experience since C++20 modules are not in the state of maintaining now.

I don't have strong opinions for the concrete decision. But I think it is very important to get in consensus. @iains @Bigcheese


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120540/new/

https://reviews.llvm.org/D120540



More information about the cfe-commits mailing list