CLion 2020.3 EAP: CTest, Set Execution Point in Debug, Qt project templates, and MISRA Checks
There are many useful changes and improvements planned for CLion 2020.3, and today we are ready to share some of them with you. CLion officially starts the 2020.3 Early Access Program today!
For those who just joined us, EAP builds are free and valid for 1 month, so you don’t need an active subscription to try them out. However, the quality of EAP builds is usually lower than that of releases. If you are wondering why taking part in an EAP is worth your while, please see this nice explanation by the WebStorm team.
Build 203.3645.37 is available from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu).
Here are the main highlights of this EAP build:
- We’ve added CTest integration.
- We’ve introduced a new Set Execution Point action that lets you start execution from an arbitrary line of code while debugging.
- Clang snippets are now used for code completion in CLion.
- We’ve started work on adding MISRA checks to CLion’s code analyzer.
- We’ve reworked the Welcome screen so that you can customize the IDE to fit your needs even better and added new Qt project templates.
- Other improvements.
CLion now comes with initial support for CTest. CLion reads all the CTest tests in your project and creates a Run/Debug configuration for them. You can then launch the tests via this configuration or by using the left-hand gutter icons in CMakeLists.txt. The results are presented in the built-in test runner (the same one that is used for presenting Google Test, Catch, Boost.Test, and doctest results):
You can debug tests in CLion. When several tests are joined under one CTest entry, the dialog to select a final test to debug is displayed:
CLion supports CTest v3.14 and higher for now. Learn more about CTest support in CLion in this blog post.
Debugger: Set Execution Point
Set Execution Point to Cursor is a new debugger action that allows you to move the execution during debugging to an arbitrary line of code in the editor. You can put a cursor on the required line and call the action from the Find Action menu (or assign a shortcut for it) or simply drag and drop the current execution pointer (an orange arrow) to the required line of code:
Execution will be resumed from that new location, skipping all other commands in between. This works not just for linear execution paths: it’s also possible to break and skip loops, or select another branch in an if-else clause or switch-case statement. See this blog post for more details and known limitations.
Clang completion snippets
Clangd comes with code snippets which CLion now uses in code completion. It works in a similar way to CLion’s live templates, which help you insert common constructs into your code. Clangd snippets are similar but are triggered when you start typing some C++ keywords. Just start typing a keyword, select the snippet from the completion list, and use the Tab key to move the cursor between stubs. See the GIFs below for some examples.
When completing a
typedef keyword, code completion can suggest not only the keyword itself but also stubs for the type and the new name.
namespace there are several handy snippets which the user can select from depending on the use case:
There are useful sets of snippets for templates and concepts. See how quickly you can define a new Concept in CLion with these snippets:
The full list of currently available snippets can be found here.
MISRA is a very popular standard for code quality in embedded development, especially in the automotive industry. In this release cycle we’ve started working on adding MISRA support in CLion. This EAP build brings a new code inspection: Settings/Preferences | Editor | Inspections | C/C++ | General | MISRA Checks, which performs checks defined by the MISRA C 2012 and MISRA C++ 2008 guidelines. Not all the checks are supported yet. We’ll continue adding more of them during the 2020.3 EAP.
The list of currently supported checks can be found here.
Updated Welcome screen and new Qt project templates
We’ve redesigned the Welcome screen. The new layout puts the most common operations at your fingertips and gives immediate access to recent projects, customization options, and plugin settings.
We’ve added two new Qt project templates to the New Project wizard:
- Qt Console Executable and
- Qt Widgets Executable.
Select the one you need and CLion will generate a sample Qt Application with the CMakeLists.txt and main.cpp files for you:
There are even more goodies included in this build, for example:
From the IntelliJ-platform side:
- It’s now possible to split an editor by dragging and dropping a tab to the side of the main editor window.
- Select Sync with OS option in Settings/Preferences | Appearance & Behavior | Appearance | Theme and CLion will automatically switch to the light or dark theme, depending on your OS preferences.
From the C++ side:
- The Jump to source action is now available for the CPU profiler on Linux.
- The OpenOCD run configuration now works with Custom Build Application targets.
That’s it for now. Try out the new EAP build today, and please share your feedback with us here in the comments or in our issue tracker.
Your CLion team
The Drive to Develop