CLion Starts 2021.3 EAP: Easier Toolchain Configuration, New Debugger UI, Parallel Stacks View, and Type Hints
The roadmap for CLion 2021.3 includes a few interesting features and lots of useful enhancements. Today we are announcing the start of the 2021.3 Early Access Program!
The main goal of the EAP is to collect feedback on the changes and fine-tune the final release. You can give the free EAP builds a try and let us know how you feel about them! Share your feedback in the comments or submit it to our issue tracker. It’s especially important for us to understand if the changes we are making affect your very specific environments or use cases. The earlier you report it, the more improvements we’ll be able to incorporate in the release and first bug-fix updates.
Build 213.3714.446 is available from our website via the Toolbox App, or as a snap package (if you are using Ubuntu). Note that if you are on macOS, there is a separate build for Apple Silicon (M1 chip).
Check out the main highlights and read the post for more details:
- Type hints
- The ability to edit names for postfix completion snippets
- Toolchains and environments
- Bundled MinGW toolchain on Windows
- Ability to initialize toolchain environment via script
- CMake update
- New debugger UI
- Parallel Stacks view
- Improved peripheral and hex views
- Clang tools update
- Static analysis
- DFA improvements
- More MISRA rules
To increase code readability, CLion provides various code hints. For example, parameter hints show the names of function parameters for passed arguments. In the CLion 2021.3 EAP, we added type hints for deduced types.
The use cases when the hints are present are
auto variables, structured bindings:
and lambda return types:
You can disable or enable specific type hints in Settings/Preferences | Editor | Inlay Hints | C/C++ or right from the hint’s context menu.
If the type hint includes the template instantiation, the template arguments can be collapsed by simply clicking on the angle brackets. Also, Ctrl+Click (on Windows/Linux) and Cmd+Click (on macOS) allow navigating to the declaration of the type you clicked on:
Postfix completion snippets
Users can now edit names of the postfix completion snippets if you prefer names different from the default ones.
Toolchains and environments became easier
If your environment is stable and you rarely change tools like compilers, you are probably not using the CLion toolchains settings after you have configured it. But for people just starting out with CLion, it’s the first thing they are introduced to. On any platform, to start with CLion, users need to select at least one of the supported environments and configure the toolchain with the compiler, debugger, and other tools. Without that initial configuration projects won’t be loaded correctly.
From CLion users’ feedback, we know that environment and toolchain configuration is challenging, especially on Windows. In this release, we are working on improving the UX and enhancing the existing functionality.
MinGW toolchain on Windows
When getting started with CLion on Windows, there are several options for environments: MinGW, Cygwin, Visual Studio, or WSL. The CLion 2021.3 EAP bundles the MinGW toolchain for quick setup, which you can rely on if you don’t have any other options installed on your machine. The exact version bundled is MinGW-w64 9.0 with
languages=c,c++, posix threads, and
Another improvement for MinGW users is a bundled GDB v 10.2 with Python support (required in CLion). Previously we had a 32-bit version bundled, but we have now switched to a 64-bit version. Since the 10.1 update, 64-bit GDB supports debugging of 32-bit targets on Windows, so you can debug both with it.
Ability to initialize toolchain environment via script
In some cases the environment in which the compiler runs is initialized via a script. It can initialize compiler environmental variables, customize the
PATH variable, and more. Sourcing a script instead of setting individual environment variables in the configs is definitely more effective. A typical example where sourcing environment scripts can be used is configuring Yocto.
This works for all types of toolchains and on all platforms. Just go to Settings/Preferences | Build, Execution, Deployment | Toolchains and select Add environment | From file:
The sourcing will happen on the first actual usage of this toolchain in the CMake profile or when a Makefile project loaded.
A few known issues include:
- Lack of error reporting for environment script loading (CPP-26641).
- No support for the environment variables from environment script for CMake presets (CPP-26576).
In CLion, you can use any CMake generator. Previously, when a generator is explicitly specified, CLion switched to CMake File API to support the selected generator. In other cases the legacy approach was used. That means parsing the output of the CMake command run with the Makefiles generator. However, CMake File API is a new and better way to query project information. Now it’s used by default for CMake versions 3.20 and higher.
If you still want to use the old legacy approach, you can turn it on in Settings/Preferences | Advanced Settings:
This EAP build bundles CMake v3.21.
New debugger UI
The debugger is one of the most important and widely used IDE features, but its UI was becoming overloaded. In this EAP, we reworked the debugger UI to make it cleaner and more compact to provide you with more space and fit more useful information. Evaluate expression is integrated right in the tool window and merged with Watches, and the control buttons have been grouped more logically.
Extra actions are available in the extended submenu under the three dots:
If you really need actions to be available in the debugger toolbar and not in the submenu, you can add them via File | Settings | Appearance & Behavior | Menus and Toolbars | Debug Header Toolbar. This is still a work in progress, and your feedback is very much appreciated!
Parallel Stacks view
Multithreaded applications are always harder to debug as you have to track multiple threads at the same time. In this case, the thread call stack information for all the threads can be helpful.
The new Parallel Stacks view is implemented as a separate tab in the debugger tool window:
The Parallel Stacks view lets you quickly look at all the threads in your application, and check the call paths and execution points of all running threads:
Improved peripheral and hex views
The peripheral view in CLion was updated to support
dim register arrays,
enumeratedValue tags in SVD files. The hexadecimal view was fixed to display
uint64_t values higher than
Clang tools update
CLion comes with the Clang-Tidy and ClangFormat bundled, and uses a Clangd-based language engine for many operations. In this EAP we’ve updated the LLVM version to 14.0.0 (you can always check the revision used in CLion in Settings/Preferences | Languages & Frameworks | C/C++ | Clangd). This brings a few new Clang-Tidy checks among other improvements:
Make sure to review the list and update the settings if needed.
Static analysis updates
We are continuing to work on making CLion’s data flow analysis more powerful. First of all, it became call-context sensitive, which means it treats different calls differently:
- Each function is analysed for each call site separately.
- Parameters and return values for different call sites are analysed separately.
This type of analysis enhances the existing checks like dangling pointers which can be caught now in more cases:
In this EAP we enhanced the invalidated pointers analysis and covered cases like a dangling iterator:
and modified owner (owners passed by non-const reference are assumed to be modified):
We continue our work on getting more examples from the Herb Sutter’s Lifetimes proposal be caughts by the CLion’s code analysis.
There are also other improvements and bug fixes in the CLion’s data flow analysis and more MISRA rules are now supported.
The full release notes are available here.
Your CLion team
The Drive to Develop