| Summary: | C++20 Modules | ||
|---|---|---|---|
| Product: | [Applications] kdevelop | Reporter: | Lukas Kahnert <openproggerfreak> |
| Component: | Language Support: CPP (Clang-based) | Assignee: | kdevelop-bugs-null |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | justusranvier, Richard1.Kellnberger |
| Priority: | NOR | Keywords: | junior-jobs |
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Lukas Kahnert
2019-04-24 11:36:45 UTC
Hey, are you maybe interested in diving into the KDevelop code base to fix this? Helping hands are needed. Since the file extension is new, it might make sense to first have a look at the "ClangHelpers::isHeader" method in clanghelpers.cpp, and make sure .cppm is detected as "header file". More information about contributing to KDevelop here: https://www.kdevelop.org/contribute-kdevelop thanks for the report! I'll try to find some time to look into this. Afaik the modules-ts implementation is still somewhat in flux, right? anyhow, to simplify our life: can you attach a fully standalone cmake/makefile-based project that I can use to look into this? Modules TS syntax itself is finished AFAIK. clang recently also enabled the -fmodules-ts flag implicitly if -std=c++2a is used. On clang 8.0 it's still unstable and segfaults in some use-cases, but with the C++20 release this situation will be better in the future. Currently converting header files to the Modules TS syntax and additional compile flags works. I try to make a small project and post the link here asap. I would also provide some additional info how modules are compiled under clang. Sadly the docs talk mostly about clang-exclusive modules which differ from C++20: Under clang c++ modules are source files(*.cppm), which can also provide declarations and in this case work like header files too. The source file, which imports a module, needs the path to a module interface unit(*.pcm), which provides the required declarations for compilation. A module interface unit is very similar to precompiled headers but with the difference that clang take only the declarations that are marked as 'export' and precompiles them as *.pcm file. Here a simple Project which uses clang for module compilation. https://github.com/OpenProgger/CXXModule-Example I hope that whenever module support gets added it does not preclude gcc support. Currently kdevelop's reliance on clang for parsing means that if you turn on precompiled headers in your project and use gcc as a compiler then the parser stops working. (Bug 407444) . Since modules are similar to precompiled headers in the sense that it's not expected to be compatible between compilers, it's possible that a naive implementation of modules in kdevelop will add another gcc incompatibility. As GCC now has module support and the feature is no longer experimental in CMake, I gave it a shot and with GCC not even a minimal example works. Modules are not found (they cannot be I guess as KDevelop uses clang for its parsing and therefore requires its respective module files.) Is there a plan/a way to handle this? I would gladly help if support for modules with GCC is possible. |