CLion 2020.2

Adds Makefile project support.
July 31, 2020 - 9:01
New Version

Features

Project models

  • Makefile project support - Developing a Makefile-based project? Benefit from CLion’s smart features - CLion now comes with Makefile project support out of the box. Open a folder with a top-level Makefile as a project, or directly point CLion to a Makefile in the Open dialog. The IDE will run make (with the --just-print option to avoid running an actual build), parse the output of the make command, and load the project.
  • Enhanced CMake UX - The CMake Profile settings under Build, Execution, Deployment | CMake have a newly polished UI, with a few useful tips added for the settings there. In addition, several actions for CMake projects are now available in Find Action, and you can assign a shortcut to any or all of them if you use them regularly.
  • CMake upgrade - CLion now bundles CMake 3.17 and adds initial support for two of its most recent features:
    • Ninja Multi-Config: you can now pass the -G "Ninja Multi-Config" generator option to get CLion build files generated for every configuration (note that, temporarily, CLion will still use only one selected configuration for the CMake profile).
    • CMake precompiled headers: use the target_precompile_headers command to add header files to the PRECOMPILE_HEADERS and/or INTERFACE_PRECOMPILE_HEADERS properties of a target. CLion will treat such precompiled headers correctly.

Building projects

  • Recompile single file - The Recompile single file action helps speed up the development process by quickly checking local changes, and it is now available for Ninja and other generators used in CMake and supported in CLion. Thanks to an important bug fix, CLion can now build multiple independent projects in parallel, without them blocking each other from starting.

Code analysis

  • Dangling pointer - Pointers that point to invalid data lead to run-time issues. Typical cases are double-free and use-after-free combinations. CLion now catches such dangling pointers if they appear in the local scope, no pointer arithmetic is involved, and macros are not preventing CLion from performing the analysis.
  • Simplify - The Simplify code inspection is now more accurate and covers more cases.
  • Loop condition is never updated - This CLion inspection detects situations where a loop condition is not updated inside the loop. It’s similar to Clang-Tidy’s clang-tidy:bugprone-infinite-loop but works for loops with exit points and can handle cases with lambdas or references.
  • Unused code - The Unused code inspection has been massively overhauled. Among other changes, it now works for type aliases, for both globally and locally defined using constructs.
  • Inspection Widget and Problems View - New Inspection Widget displays the number of warnings and errors in the current file and lets you navigate between them with ease. You can also configure the highlighting level (just like you could previously with the so-called Hector icon).

C++20

  • C++20 keywords - Newly added keywords are supported by CLion 2020.2 in code highlighting and completion:
    • char8_t
    • consteval and constinit
    • co_await, co_return, and co_yield
  • Designated initializers - Code completion in designated initializers now works for fields from a base class.
  • explicit(bool) - The C++20 explicit(bool) construct is now highlighted correctly. It’s also equipped with name hints for condition arguments and is supported in navigation and refactoring.
  • Range-based for with initializer - Range-based for loops with the init statement are now supported. This includes refactorings like Rename for variables in the loop.
  • Constrain a function's result - A new inspection for code that uses Concepts has been added. It suggests constraining local variables declared as auto if the result of a constrained function call is assigned to them.

Unit testing

  • Doctest support - CLion 2020.2 adds support for yet another single-header framework for C++ - Doctest. Doctest has gained popularity in the community and is now supported by CLion, with automatic test detection, Run/Debug configuration creation, and a handy built-in test runner to display test results.
  • Catch2 template tests - These types of tests in Catch2 are now recognized and handled just like the other test types.
  • Skipping tests in Google Test - The GTEST_SKIP() macro in Google Test provides the ability to skip tests at runtime. This is now supported by CLion.

Code coverage

  • CLion 2020.2 improves the user experience by adding coverage flags automatically when you click the Run with Coverage button. Now, if your currently selected CMake profile doesn’t include compiler options for coverage, CLion will search for a CMake profile (and create one if not found) with the coverage flags passed via CMAKE_CXX_FLAGS and CMAKE_C_FLAGS.

Embedded development: PlatformIO plugin

  • Highlighting in platformio.ini files - PlatformIO project configuration files are now highlighted properly, so you can read and update them more easily.
  • New Run/Debug configurations - When a new project is created from the New Project Wizard in CLion, many useful Run/Debug configurations are added automatically. For example, _PROGRAM, _MONITOR, _CLEAN, _TEST, and many others.
  • CMake Profiles for PlatformIO configurations - CLion now automatically creates CMake Profiles for the CMAKE_CONFIGURATION_TYPES entries in the PlatformIO CMake project.

VCS

  • Git installed in WSL2 - If you develop with the WSL2 toolchains and use Git on WSL2, you will now benefit from CLion switching between Git executables depending on the project location. It will auto-detect the Git executable from WSL2 for projects opened from there (via \\wsl$ path) and switch all Git-related features to work with it.
  • GitHub Pull Requests - CLion 2020.2 introduces a new and more spacious view for GitHub Pull Requests. It shows all the details of a particular pull request (like messages, branch names, author, assignee, changed files, commits, and timeline) and displays the results of the pre-commit checks. It also helps with many actions like start a review, request reviews, attach comments, or merge pull requests from within the IDE.

Go to Declaration or Usages

  • The Go to Declaration or Usages action (Ctrl+Click / Ctrl+B) behaves differently depending on the case and the IDE settings:
    • 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.
    • When invoked on a definition, it shows the associated declaration or usages. This depends on the settings in Settings | Editor | General | Go to Declaration or Usages.

Performance improvements

  • A few UI freezes and slowdowns have been fixed. To avoid editor performance degradation, CLion now inserts a backslash on pressing Enter inside the macro definition. The macro definition will quite likely be continued on a new line, so this saves the IDE from redundantly reparsing activity.

Rust plugin update

  • In version 0.3 of the plugin, the new engine for macro expansion, which until now had been experimental, is enabled by default. This engine handles macro-generated impl blocks and module declarations, providing code insight for the entirety of your code, including crates like tokio and async-std.
  • Another major update is the introduction of initial debugger support for Rust’s MSVC toolchain. Now you can use the LLDB-based debugger bundled in CLion for the Microsoft Visual Studio toolchain to debug Rust code built on Microsoft Windows using Rust’s MSVC.
  • Other enhancements include new refactorings (Move for files and top-level items and Introduce Constant), initial support for or_patterns, error highlighting in format literals inside macros like println!, rendering for documentation in the editor, inlay hints for chain method calls, and improvements to the debugger workflow in IntelliJ IDEA.

Other improvements

  • The LLDB-based debugger for the Microsoft Visual Studio C++ toolchain maintained by JetBrains has been given a significant number of improvements. The most notable are: debug sessions no longer freeze on stop, threads are now named automatically based on their entry-point function, the debugger gained significant performance improvements, and many freezes and crashes were fixed.
  • Updated GDB STL pretty-printers are bundled into CLion 2020.2.
  • From now on, the Clangd-based engine is the default language engine in CLion and the option to turn it off has been removed. Settings | Languages & Frameworks | C/C++ | Clangd now includes information on the LLVM Clang revision used, so you will know what to expect in terms of C++ support and built-in Clang-Tidy checks.
Makefile project support

CLion

A cross-platform IDE for C and C++.

CLion is also available in:

Got a Question?

Live Chat with our JetBrains licensing specialists now.