Early Access Program News

CLion 2022.3 EAP: C++20 Modules Now Supported!

A new CLion 2022.3 EAP build is available!

Download build 223.7126.6 from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). If you are on macOS, there is a separate build for Apple Silicon (M1 chip). Update via patch if you are using the previous EAP build.

DOWNLOAD CLION 2022.3 EAP

In this EAP build you can find:

C++20 modules

Modules are a new feature in C++20. They were introduced to reduce many of the problems associated with the use of header files by isolating declarations and keeping their visibility limited to the module. There is also a hope that modules will be able to reduce compilation times in many cases. The feature had a long and challenging path from the initial idea to its acceptance as part of the standard. Even as part of the standard, it still suffers from the lack of tooling support.

In particular, the majority of C++ project models don’t work with modules. CMake has started working in this direction and offers some initial support. For example, it now works with modules when the Visual Studio generator is used.

How modules work in CLion

Whichever approach you use to compile modules on your project, CLion 2022.3 EAP now:

  1. Collects information from all .ixx, .cppm, and .mxx files.
  2. Parses export module {name} statements and creates mappings between {name} and module filenames.
  3. Passes these mappings to the Clangd-based language engine and uses them to provide code assistance and code highlighting.

The information collected from modules is preserved between CLion restarts. If you update the module’s code or rename the module, CLion automatically parses the changes.

What works and what doesn’t

Code assistance for modules in CLion 2022.3 EAP includes:

Syntax highlighting for the new module keywords (import, export, and module):
Syntax highlighting

Completion for symbols from modules:
Completion

Navigation to declaration/definition for symbols from modules:
Navigation through modules

Find Usages and refactorings work as usual inside modules. You can also try out an early version of the Rename, Change Signature, and Extract refactorings that work across module boundaries. For now, they only work for files opened in CLion (CPP-30812):
Refactorings in modules

Our team tested this in the following environments:

  • CMake, Ninja generator, Visual Studio C++ toolchain.
  • CMake, Visual Studio generator, Visual Studio C++ toolchain.
  • CMake, Clang toolchain with compiler flags.

Modules support in CLion is still under development, and these are other known issues:

  • CLion doesn’t support modules from the MSVC standard library (CPP-30782).
  • Header imports are not yet supported (CPP-30781).
  • There currently is no action to add a new module from the project view (CPP-30785).
  • Code completion is not available for module keywords and module names in import statements (CPP-30784).
  • It is not currently possible to navigate to a module from the module name in the import statement (CPP-30798).
  • CLion doesn’t consider .cpp files to be modules, so for now it is better to use other extensions (for example .cppm).

Import profiling results

Previously, you could export profiling results in CLion on macOS. Now we are extending the functionality to all platforms and also making it possible to import profiling results back to CLion. This is useful when profiling on a remote or embedded target and importing the results locally in CLion. Import the already captured results via Run | Open Profiler Snapshot, selecting a new file or one of the recently opened ones:

Profiler

The results are exported into a .collapsed file. This file includes call traces in the format used by the FlameGraph script. The format is standardized and presents the collection of call stacks, where each line is a semicolon-separated list of frames followed by a counter.

Jump to Source navigation works correctly for profiling data and continues to do so after import/export.

Our current implementation is platform-dependent, so for example, profiler results from macOS or Linux can’t be opened on Windows. We plan to address this in further updates (CPP-30741).

A new way to work with projects in WSL2

CLion 2022.3 brings an alternative way to work with projects running in WSL2 file systems. Instead of running a full IDE on Windows, your IDE backend will launch directly in WSL2 itself. Then you connect to it the same way you would connect to any remote machine when using remote development in CLion. This can provide better IDE performance when working with projects in WSL2.
New WSL remote

Other highlights

  • In settings, CLion CMake profiles created from the CMake presets now appear in the same order as in the CMakePresets.json file.
  • We have continued to improve the highlighting for CMake command arguments in this EAP build (CPP-30018, CPP-30013).
  • We’ve implemented a few improvements to parameter hints (CPP-30636, CPP-30638).
  • CUDA attributes are no longer highlighted with red when remote toolchains are used (CPP-18964).
  • The RTOS thread view now also works for Symmetric Multiprocessing (SMP). This only works if the processor cores are identical. (CPP-29686)

The full release notes are available here.

DOWNLOAD CLION 2022.3 EAP

Your CLion team
JetBrains
The Drive to Develop

image description

Discover more