Description of the project: Clang currently handles modules independently in each
clang instance using the filesystem for synchronization of which instance builds a given module. This has many issues with soundness and performance due to tradeoffs made for module reuse and filesystem contention.
Clang has another way of building modules, explicitly built modules, that currently requires build system changes to adopt. Here the build system determines which modules are needed, for example by using clang-scan-deps, and ensures those modules are built before running the
clang compile task that needs them.
In order to allow adoption of this new way of building modules without major build system work we need a module build daemon. With a small change to the command line, clang will connect to this daemon and ask for the modules it needs. The module build daemon then either returns an existing valid module, or builds and then returns it.
There is an existing open source dependency scanning daemon that is in a llvm-project fork. This only handles file dependencies, but has an IPC mechanism. This IPC system could be used as a base for the modules build daemon, but does need to be extended to work on Windows.
- llvm-project/clang/lib/Tooling/DependencyScanning at main · llvm/llvm-project · GitHub - upstream implementation of the dependency scanner
- llvm-project/cc1depscan_main.cpp at next · apple/llvm-project · GitHub - downstream implementation of a scanning daemon
- 2022 EuroLLVM Dev Mtg “Implicitly discovered, explicitly built Clang modules” - YouTube Jan Svoboda: Implicitly discovered, explicitly built Clang modules
Expected result: A normal project using Clang modules with an existing build system (like Make or CMake) can be built using only explicitly built modules via a modules build daemon.
Desirable skills: Intermediate C++ programming skills; familiarity with compilers; familiarity with Clang is an asset, but not required.
Project size: 175h or 350h depending on reuse of IPC
Confirmed Mentors: Michael Spencer, Jan Svoboda