[clang-tools-extra] [clangd] [C++20] [Modules] Introduce initial support for C++20 Modules (PR #66462)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 31 00:56:23 PDT 2023


ChuanqiXu9 wrote:

@sam-mccall  Thanks for you high quality comments! I think all the comments (except few ones I explained in inline comments) should be addressed in the latest force-push commit. I didn't click the `Resolve Conversation` button since there is a discussion for it: https://discourse.llvm.org/t/rfc-github-pr-resolve-conversation-button/73178/42.

The "significant" changes in the latest commit are mainly interface changes. They include:
- Introduced a `ModulesBuilder` class. The class is responsible for building module files.  Currently it follows the original style to build module files seperetely for every different source files. As we discussed, `ModulesBuilder` class can be used to reuse the module files across different source files.
- Split `buildPrerequisiteModulesFor` from `PrerequisiteModules` to `ModulesBuilder` class. Now `PrerequisiteModules` are simply collection of module files. And it has two duties:
    - Check if all the module files are still up-to-date (or valid)
    - Adjust the header search options to make it to try search for the module files built by us first.
- Split the original `PrerequisiteModules` to a pure virtual class and move the implementations to `ModulesBuilder.cpp`.
- `ScanningAllProjectModules` are removed from the header files.
- The suggested ModuleFile class are introduced as a private class to `StandalonePrerequisiteModules`. I think it is good now since all the module files are owned by `StandalonePrerequisiteModules` and they are private to others.
 
I can image, in the end of the day, we need to have a "public" ModuleFile class which are owned by `ModulesBuilder` to make it to be shared with other source files. And derived class from  `PrerequisiteModules` will only have references to some module files. But I didn't move on. I feel they should be part of the later patches. 

https://github.com/llvm/llvm-project/pull/66462


More information about the cfe-commits mailing list