News Releases

CLion 2021.1: New Code Analysis Options, Updates to Remote Mode, and Postfix Completion

Read this post in other languages:

The first release of the year, CLion 2021.1, is now available!

This new version provides an overhaul for code analysis, allowing it to catch more potential issues and guideline inconsistencies, enhances the debugging experience, and improves the capabilities of remote mode. In addition to the improved C and C++ experience, CLion 2021.1 introduces updated Rust and Swift support and valuable changes from the IntelliJ Platform.

CLion 2021.1 release

To update to the new version, you can use the Toolbox App or a snap package (on Ubuntu), download the installer from our website, or apply the patch update to upgrade from the last 2020.3 build.


In this release:

Code analysis

Catching issues as early as possible and checking your code against the guidelines is essential for improving code quality. An IDE can help with this task by running code inspections and highlighting potential issues on the fly in the code editor.

In CLion 2021.1 we’ve focused on improving the variety and accuracy of code analysis checks available to users in three main areas:

  1. Including a global DFA (which takes a whole translation unit of a program as a single unit for analysis), in addition to the local DFA (which works within a single function).
  2. Integrating Clazy, a Qt-oriented static code analyzer.
  3. Introducing more checks from MISRA C 2012 and MISRA C++ 2008.

Let’s take a look at all three.

Data flow analysis (DFA) tracks the flow of data in your code and detects potential issues based on that analysis. It’s capable of detecting dangerous cases like dangling pointers, null dereferencing, or variables escaping their scope. CLion previously ran these checks locally, within the body of a single function. In v2021.1, CLion includes global DFA, which runs these inspections on translation units. This catches the same issues in a wider range of situations.

Dangling pointer

Global DFA is not just an improvement to local DFA, it also makes it possible to run additional checks that are only possible in global mode:

  • Constant function result – reports functions whose return values appear to always be the same constant.
  • Constant parameter – reports functions where a parameter appears to always be the same constant.
  • Unreachable function calls – detects functions whose call sites are never executed.

Unreachable function calls

While introducing global DFA we reworked many of the underlined algorithms, which improved analysis performance. Read more about it in this separate blog post.

If you are working on a Qt-based project in CLion, you’ll be happy to learn that Clazy, a Qt-specific code analyzer, is now integrated into CLion’s Clangd-based engine. You’ll now get Clazy checks and quick-fixes right in the editor!

Clazy integration

The inspection severity level and the Clazy check level can be configured in Settings/Preferences | Editor | Inspections | C/C++ | General | Clazy.

To wrap up with the code analysis update in CLion 2021.1, we’d like to mention that we’ve added another pack of MISRA C 2012 and MISRA C++ 2008 checks. Not all checks are supported, but the improvement over the previous release is significant. The full list of available checks is maintained on our confluence page and allows you to easily track our progress.

Now it’s demo time! Watch a recent update to code analysis in CLion in this short video from Phil Nash, our developer advocate:

Enhancements for various project types

In addition to the new code analysis support we’ve added for Qt with the Clazy analyzer, we’ve also improved the Qt experience from a project model standpoint by implementing a small redesign for the New Qt UI Class dialog. You can now:

  • Specify the namespace.
  • Type a custom name for the parent class (previously you could only select from a few predefined options).

Qt UI Class

If you are working on a Qt-based project, you’ll be interested in the Qt Creator keymap, which is now bundled into CLion.

We have continued to improve Makefile project support in CLion. In this release we’ve bundled the Makefile Language plugin (previously third-party), which provides syntax highlighting in Makefile, quick documentation, Find Usages for targets, and a variety of navigation and code completion actions. We’ve also started working on remote mode support for Makefile projects.

Remote Makefile

It now works in a limited number of use cases. Makefile should be present in the project directory, and please note that if a pre-configure step is required, CLion can’t automate it for now. Check out the other limitations and known issues.

For CMake, we’ve added the ability to share CMake Profiles. Tick the Share setting in Settings/Preferences | Build, Execution, Deployment | CMake, and then commit cmake.xml to VCS:

cmake.xml to VCS

CLion 2021.1 also bundles CMake 3.19. This is the first CMake version to support Apple Silicon (M1 chip).

Whichever build system you are using, Project View gives you an overview of the files in your project. Source files located outside of the project root are now grouped under the External Sources node in the Project tree. This helps prevent the top-level crowding of these files.

External Sources

Time for another demo from Phil:

Open Project wizard

When you first get started with CLion or open a project for the first time in CLion, some additional configuration is often required. A new Open Project wizard is here to help!

The first step is the Toolchains configuration. It is shown only if CLion is being launched for the first time and settings were not imported. This step is essential, since no project can be opened and loaded in CLion without a toolchain configured.

The second step only appears for CMake projects, and it’s about CMake Profiles configuration. It is displayed if the project is opened for the first time (if the .idea directory is missing), if workspace.xml is missing from .idea, or if all the profiles are disabled. Of course, you can step back to the Toolchains configuration from CMake Profiles:

Open Project Wizard

Before you even see the wizard, CLion will ask you if you trust the project you are opening. The concept of trusted projects is designed to mitigate the risks associated with opening projects from unknown and untrusted sources. It’s a consequence of the approach that modern build systems are using, where they rely on code execution for building the project model that the IDE needs in order to understand the project structure and its dependencies. You can read more about the solution implemented in our IDEs in this blog post. Here’s what you’ll see in CLion when opening a CMake, Makefile, or Gradle project for the first time, for example from a VCS:

Trusted projects


In CLion 2021.1, GDB and LLDB have reached feature parity for core dump debugging in CLion! To achieve this, we’ve added the ability to explicitly set symbol files when debugging a core dump for non-symbolized binary. Users can now also set sysroot in the corresponding run configuration. This will help localize library symbols when debugging core dumps from binaries built on other systems:

Core Dump configuration

The Set Execution Point action lets you jump to an arbitrary line of code in the editor during a debug session and is now available in the disassembly view.

Check out another demo from Phil on the debugger enhancements, as well as our new page fully dedicated to Debugger abilities in CLion.

Remote development and dynamic analysis tools

In addition to support for remote Makefile projects, CLion introduces a variety of further enhancements to remote mode! Dynamic analysis tools – Google Sanitizers, Valgrind Memcheck, and Code Coverage – now work with remote toolchains. And speaking of Code Coverage, CLion 2021.1 can now also calculate Branch Coverage in addition to line coverage. Let’s run unit tests with code coverage on a demo project remotely, from a local Mac to the remote Linux machine. The results can be inspected in the Coverage tool window:

Branch Coverage

Branch coverage is enabled by default and can be adjusted in Settings/Preferences | Build, Execution, Deployment | Coverage, but it only works with GCC/gcov or version 12.0.0 and higher of LLVM/llvm-cov. Read more in this blog post.

When you work with remote projects, you might need to adjust something manually or check the remote directory containing your project. There is a remote terminal in the IDE and a new Tools | Open Remote Host Terminal action that directly opens the project directory on the remote host.

We also would like to mention Code With Me, the new built-in service for remote collaborative development and pair programming. Code With Me connects remote teams in a feature-rich collaborative environment and helps boost productivity, no matter where the team members are based. The essential IDE features, such as smart code insight, navigation, remote unit testing, and debugging, are available for participants during collaborative sessions. Teams can simultaneously edit code, track changes with diff previews, and follow each other in the shared project. The embedded audio and video calls, along with chat messaging, help software developers discuss the code, share their knowledge, and cooperate more efficiently.

For those who must follow strict security policies, Code With Me has an on-premises version. The service can be installed and run securely on the company’s own private network. To learn more about the availability of Code With Me with your current JetBrains license, check out the pricing page.

Postfix completion for C and C++

Sometimes you may want to type a collection and then wrap it with the for loop to iterate through it. Or you may need to get a type and then create a shared or unique pointer of this type, or wrap a given expression with one of the C++ style casts. In all these scenarios, you can start with an expression and then wrap it with some “action”, which is represented by a language construct, even though the “action” goes first in the final code. CLion 2021.1 introduces postfix completion for C and C++ to support this approach to coding.

Postfix completion templates

You will find a long list of postfix templates that work this way in Settings/Preferences | Editor | General | Postfix Completion.

If you miss the Uniform Function Call Syntax (UFCS) in C and C++, the new postfix completion feature offers a very similar experience. You can use postfix code completion to pass the expression you’ve just typed to a free function as the first argument:

Postfix completion for free function

Learn more in this blog post, and watch it in action:

By the way, this feature isn’t new in our C++ tools. In ReSharper C++, our C++ extension for Visual Studio, we also have a similar postfix completion ability.

VCS support enhancements

There are a bunch of updates coming to CLion from the IntelliJ Platform. This includes a number of VCS support enhancements:

  • Code inspection profiles that you can select to execute before committing changes to VCS
  • Support for custom commit message templates in Git
  • A new Save to Shelf action (which allows you to copy your changes to the Shelf while keeping them in the local changes)

Rust and Swift plugin updates

The IntelliJ Rust plugin team has prepared a lot of fixes and improvements. Read more about them here. We just want to take a moment to highlight the new structured view for the compiler’s build output, the new Change Signature refactoring, updates to the Rename refactoring, and the ability to use Find Usages for Cargo features.

Thanks to the AppCode team, the Swift plugin is now available in CLion on Windows! You can find a few tips on how to get the toolchain, as well as information about some known issues, in this blog post.

That’s it! We encourage you to give CLion 2021.1 a try. Update today if you have an active subscription, or start your free 30-day trial to evaluate the new features!


Your CLion team
The Drive to Develop

image description

Discover more