-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for modules #70
Comments
C++20 modules are currently not yet available in clang. However, they have become available in gcc trunk (wiki and docs). |
Note, Bazel appears to now support building modules with clang: https://buildingblock.ai/cpp20-modules-bazel
|
As demonstrated on the merged PR #129, it is possible to create custom toolchains now, meaning we could test modules compilation with gcc now. A note regarding build stages: |
@GPMueller, have you had any more recent experience with modules? |
Hi @naturallymitchell. Unfortunately not - did something get updated on clang's side? |
|
CMake is progressing: https://www.kitware.com/import-cmake-c20-modules |
It completely went past me that clang-15 added standard C++ modules support 🎉 There's now a clang-15-based modules examples at
@NOhs Looks like we could finally start creating and testing a modules-build mechanism. |
With relatively few modifications I'm able to build the trivial case (see PR #139), but the following example from the clang docs doesn't seem to be possible without either
The 3rd option, i.e. clang determining the dependencies, is the solution I'm hoping for, as I believe that would be the most stable and toolable solution. While clang-build would still have to reconstruct the dependency-graph out of multiple dependency files, working with what the compiler sees seems the most reliable to me. |
I don't know if anyone had a similar problem with LLVM-linker (LLD). Tests on $> zig c++ -std=c++20 -fmodules -fbuiltin-module-map -fmodules-ts -Xclang -emit-module-interface -c moduleTest.cpp -o moduleTest.pcm
LLD Link... ld.lld: error: /home/kassane/.cache/zig/o/ec639bf9d5e7c589c4e222dd65d28017/moduleTest.o:995: unclosed quote |
Thanks @naturallymitchell that might be a useful reference in the future. IIRC CMake achieves its modules support by constructing the module dependencies itself, which I don't want to do in clang-build. I'm waiting to see whether clang will provide a way to output module dependencies, analogous to (or included in) the include-dependencies it can output using the |
By now the LLVM docs actually describe how to get the module dependencies using See also this CMake blog post for the invocations CMake generates: https://www.kitware.com/import-cmake-the-experiment-is-over
As |
https://clang.llvm.org/docs/Modules.html
The text was updated successfully, but these errors were encountered: