[PATCH] D125773: [Driver] Do not auto-enable header modules with -std=c++20

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 18 13:18:59 PDT 2022


rsmith added a comment.

Header modules are part of the C++20 standard (where they are called "header units"), and module maps are an intended way for Clang to provide this functionality in C++20 mode. I don't think turning this off by default in C++20 is the right forward-looking plan; rather, I think we should be thinking about moving towards header modules simply always being something that Clang can do, with no flag to control that.

That said: this new flag is not actually turning off header modules -- we'll still treat headers listed in module maps as having modular semantics with this flag specified (especially if `-fmodules-local-submodule-visibility` is enabled, but some modules semantics such as checking for undeclared dependencies are applied regardless). Rather, this flag will cause us to parse header modules on the fly, as part of the same parsing action, rather than building and importing a separate AST for them. And I think that is a reasonable thing to have a flag for. Maybe `-fheader-modules=parse` (to parse them on the fly) versus `-fheader-modules=import` (to import them from a `pcm` file)? This would also leave the door open for being able to specify whether modular semantics are enabled for header modules or not, as a different value for the same flag.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125773



More information about the cfe-commits mailing list