Early Access Program

CLion 2020.2 EAP: CMake Updates, C++20 Enhancements, Unit Testing, and More

Last week the CLion 2020.2 EAP introduced the super-useful dangling pointer analysis. Have you had a chance to try it out yet? Meanwhile, we’ve been moving forward with CLion 2020.2!

A new CLion 2020.2 EAP build 202.6250.12 is now available for download. You can get it from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). A patch update is ready for anyone using the previous 2020.2 EAP build:


C++20 support improvements

We’ve updated the Clangd engine in CLion 2020.2, and fixed many crashes that happened in it on the C++20 code. It’s definitely now more stable for the latest available C++ standard. We are also continuing to add support for the C++20 features, and this build includes the following improvements:

  • Code completion in designated initializers now works for fields from a base class:
    Designated Initializers Completion
  • The explicit(bool) construct is now highlighted correctly, and the name hints for the condition arguments are shown:
    Explicit bool
    This EAP also supports refactorings and navigation inside the explicit(bool) construct.

CMake updates

The CMake Profile settings under Build, Execution, Deployment | CMake has a newly polished UI, with a few useful tips added for the settings there:
New CMake Profiles

CMake 3.17 brought the Ninja Multi-Config feature. We’ve recently implemented support for this new generator (-G "Ninja Multi-Config") in CLion. However, there is a limitation that’s worth noting. Currently, multi-config generators in CLion create build files for every configuration, but only the one selected for the CMake profile is actually used by CLion. We are planning to add a UI to support multi-config generators, later (CPP-20890).

CLion 2020.2 now bundles CMake 3.17. However, there are still two important known issues that need to be resolved. There is the issue we mentioned above, and there is also an issue with the support for the CMake 3.16 PRECOMPILED_HEADERS target property (CPP-18582). We are now working hard to resolve both of these issues as soon as possible.

Unit testing with Google Test

CLion now supports skipping tests at runtime (for Google Test). Just use the GTEST_SKIP() macro for this. Additionally, selecting and running multiple tests no longer results in a "Preparation canceled" message (CPP-20039).

Go to declaration / Find Usages

In CLion, the action Go to Declaration or Usages (Ctrl+Click / Ctrl+B on Linux/Windows, ⌘Click / ⌘B / force-touch on macOS) works differently for different cases:

  • When invoked on a symbol usage, it navigates to that usage’s declaration.
  • When invoked on a declaration, it shows the list of that declaration’s usages.

This behavior is compatible with the other IDEs on the IntelliJ Platform, including PyCharm, GoLand, IntelliJ IDEA, and others.

However, another Go to Declaration or Usages behavior is possible in CLion as well:

  • When invoked on a definition, it shows the associated declaration.

Would you prefer to jump to the declaration from the definition or to get the list of usages like in other IntelliJ Platform IDEs? To control this behavior we’ve added a new option:
Go to declaration setting

By default, Show usages popup is selected, which means usages are shown:
Show usages
If you select Jump to predeclaration, then you’ll be taken to the declaration if it exists.

Note that, to go to the declaration, you can also use a left-gutter icon.

In addition to all this, a few frustrating bugs have also been fixed in this build:

  • An extra closing brace was being added by mistake when pressing Enter after the opening brace and in presence of #ifdef (CPP-2879).
  • A regression was causing autocompletion not to appear for C structs (CPP-20555).
  • A scope was breaking scope detection when opened in conditional code (CPP-12333).

This EAP also has an updated GDB STL pretty-printer bundled into it. Refer to the confluence page for the full list of fixes.


Your CLion team
The Drive to Develop

image description