What's New in CLion

CLion 2020.1 brings dozens of improvements across many IDE features, from language support to the debugger, the formatter, and refactorings. Windows developers as well as developers of embedded and CUDA projects can also enjoy new benefits included for them.

Embedded Development

IAR Toolchain

IAR Toolchain

If you use the IAR compiler/toolchain in your embedded projects, you can now do so in CLion. Collecting compiler information no longer fails, which means projects using the IAR toolchain load successfully and work in CLion.

A few things to note here:

  • MinGW is required.
  • A few tips on using CMake with IAR Embedded Workbench.
PlatformIO

PlatformIO

PlatformIO is a new generation ecosystem that is gaining popularity quickly. To benefit from it in your embedded projects, take advantage of a new PlatformIO for CLion plugin, which:

  • Adds the PlatformIO project type to the New Project wizard.
  • Generates the corresponding PlatformIO CMake-based project.
  • Automatically creates configurations for debug and upload.
  • Allows for debugging with the PIO Unified Debugger from CLion right on chip.

And much more! Check the official documentation for details.

CUDA support

Code parsing and code assistance

Code in CUDA C and C++, including all CUDA specific extensions, is now parsed and highlighted correctly. This means code navigation, code documentation, and other code assistance actions work in CUDA code. Additionally, CLion can complete angle brackets for kernel calls.

Let's clone the ClaraGenomicsAnalysis project from GitHub and check out what CLion is capable of in terms of CUDA support.

New Project wizard

New Project wizard

The New Project wizard in CLion has been updated with a new option to create CUDA projects – libraries or executables. When selected, it generates sample CMakeLists.txt and main.cu files for you.

File extensions and CMake targets

File extensions and CMake targets

New supported CUDA file extensions – .cu and .cuh – are available in the new C/C++ file creation dialog. And the list of possible targets to update in this dialog includes both general CMake and CUDA specific targets (created with cuda_add_executable and cuda_add_library commands).

Learn more

Development on Windows

Clang-cl

Clang-cl

We have now made it possible to use clang-cl in CLion on Windows, with versions 8.0 and later supported.

You can install it from the LLVM website or along with the Visual Studio tools. When done, select the Visual Studio toolchain in CLion and point to clang-cl.exe in the toolchain settings.

Debugger for the Visual Studio C++ toolchain

Debugger for the Visual Studio C++ toolchain

The LLDB-based debugger for the Visual Studio C++ toolchain developed by JetBrains is now the default debugger for this toolchain. So you can start using it right away!

Note that bundled support for native visualizers should be enabled explicitly in Settings | Build, Execution, Deployment | Debugger Data Views | Enable NatVis renderers for LLDB.

Run and Debug configurations

Custom targets for remote and embedded GDB

Custom targets for remote and embedded GDB

Remote GDB Server and Embedded GDB Server configurations now work with custom targets. These configurations, which previously only worked with CMake targets, allow you to debug your application on a remote host or on the microcontroller from the CLion instance running on your local machine.

If you have already created these configurations, CLion 2020.1 will store previous Run/Debug Configuration settings in the projectFilesBackup directory in the project folder and will notify you about this.

Support for macros and path variables in Run/Debug configurations

Support for macros and path variables in Run/Debug configurations

You can now use Path Variables and macros in the Program Arguments and Working Directory fields in the CMake, Custom Build, and Gradle Native Applications configurations. Macros help you get values for:

  • The build directory for the current CMake run configuration.
  • The generation directory for the current CMake run configuration.
  • The project file directory.
  • And many others.

FilePrompt/Prompt macros can be used to show a file chooser dialog or string input dialog when running/debugging the configuration.

Path Variable can define a path to the library that is used widely in your projects but is located outside the project directory.

Input redirection

Input redirection

If you need to redirect input from a file to the stdin of your application, you can now do that. Use a new field in the configuration called Redirect input from. Enter:

  • A relative path (CLion will prepend with the Working directory path).
  • An absolute path (will be remapped for remote configurations).
  • Or macros (like FilePrompt).

Clang tools

DFA on Clangd

DFA on Clangd

CLion's Data Flow Analysis (DFA) does what a compiler doesn't normally do for you: It analyzes how the data flows through your code and detects potential issues based on the results. It catches conditions that are always false/true, endless loops, missing return statements, infinite recursion, and more. And with 2020.1, DFA has moved to the Clangd-based language engine to become more accurate and less heavy in terms of performance. This is still a work in progress, but some good results are already available!

Clangd-only completion

Clangd-only completion

A new mode, in which completion is fully provided by the Clangd-based language engine, is on by default. This mode solves the prioritization and ordering issues that occurred when code completion results from several engines were mixed. This behavior is controlled by the Code Completion setting in Settings | Languages & Frameworks | C/C++ | Clangd.

Dozens of various fixes and enhancements make this new mode accurate and powerful.

Learn more

ClangFormat

ClangFormat

Now, when you first open a project with a .clang-format config file in the project root, CLion will detect it and switch to ClangFormat for you automatically.

If you enable ClangFormat on a project that doesn't have a .clang-format config file, CLion will suggest creating one for you.

Clang-Tidy

Clang-Tidy

When a .clang-tidy config file is detected in the project, CLion now automatically turns off the use of the IDE settings for Clang-Tidy. The behavior is controlled by Prefer .clang-tidy files over IDE settings in Settings | Editor | Inspections | C/C++ | General | Clang-Tidy.

Formatter and code folding

New naming settings

New naming settings

Struct member fields and class member fields now have separate naming settings. Check them out in Settings | Editor | Code Style | C/C++ | Naming Convention.

Code folding

Code folding

#pragma region and #pragma endregion can be used in CLion for code folding.

Refactorings update

Refactorings update

When calling the Change Signature refactoring (Ctrl+F6), CLion updates all the usages of the function. A new Default value field in the Change Signature dialog offers the ability to specify the value of the parameter to be used across all usages. Keep it blank to use the default value type as before.

The same logic and a new Default value field apply to the Create Parameter From Usage quick-fix and the Add Parameter to Constructor intention.

Editor

Quick Documentation

Quick Documentation

Quick Documentation – a universal tool to preview documentation and get information about function signature, inferred types, and macro replacement – is now available on mouseover.

It can be controlled by the setting Show quick documentation on mouse move in Settings | Editor | Code Editing.

JetBrains Mono and IntelliJ Light

JetBrains Mono and IntelliJ Light

The default font in the editor has been changed to JetBrains Mono, a new open source font created by JetBrains. It's been designed specifically to make reading code easier.

A new default light theme – IntelliJ Light – is now the standard theme across all the different operating systems. Use View | Quick Switch Scheme | Theme to select a non-default theme if you wish.

Split terminal sessions

Split terminal sessions

With CLion 2020.1 you can split terminal sessions vertically or horizontally so that you can run them side by side. You can invoke the context menu from the Terminal to create, navigate, and close a split terminal session.

Version Control

Commit tool window and Commit dialog

New Commit tool window

An updated tool window provides more space for the list of modified files and the diff. It also lets you add changes to a commit when they are ready, compose a commit message iteratively, and choose which of the staged changes go into which commit.

The new UI is enabled by default for new users; existing users can switch to it in Settings | Version Control | Commit.

Interactively Rebase from Here

An updated, truly interactive dialog makes it possible to:

  • Select an action you want to perform on each commit in your branch.
  • Check a graph showing which actions have been applied.
  • View the commit details.
  • See a diff, and review or reset the changes if necessary.

Install Git from the IDE

The Version Control tool window is now called the Git tool window, or Subversion/Mercurial/Perforce if you are using any of these instead of Git.

You no longer need to pre-install Git manually! When you open a project using Git or import one from the VCS, if you don't have Git on your machine, CLion will offer to download and install Git for you.

Rust plugin update

Rust plugin update

With improvements to LLDB support, IntelliJ Rust now properly renders enums and primitive types, and it also shows demangled function names in the call stack.

Another major update that has landed in the plugin is REPL integration. Invoke the console from Tools | Rust REPL and use it for prototyping and checking your code line by line. The integration provides syntax highlighting and code completion, along with some handy console actions: command history, soft wrap, quick scroll to end, and others.

On the language-support side, IntelliJ Rust now handles impl blocks for type aliases. Taking performance into account, we've only enabled this feature for types with a limited number of aliases.

Other enhancements include highlighting for unused local variables, fixes in cfg attribute support, and the new Lift return inspection.

Other improvements

  • All remote configurations now benefit from using the common and unified SSH Configurations UI. No matter where a new SSH configuration originates (be that remote toolchains settings or Remote GDB server configurations), it will have an entry in Settings | Tools | SSH Configurations.
  • If you want to focus solely on your source code, you can select a new Zen mode, which combines Distraction-Free Mode with Full Screen Mode. To enable it, use View | Appearance | Enter Zen Mode.

What's New in CLion 2019.3

Better IDE Performance

This release of CLion is quality-targeted with lots of performance improvements made throughout. The key enhancements affect code completion, the Rename refactoring, optimizations for the Building/Updating symbols step, and the elimination of UI freezes.

Learn more

Clangd-based code completion

Clangd is now added to the list of code completion providers in CLion, which helped speed up the time for the first results to appear on many projects significantly. Check out the detailed performance metrics we’ve gathered.

refactoring

Quicker Rename refactoring

The Rename refactoring in CLion is really powerful as it can rename not only code usages but also usages in string literals and comments. If you still want to rename only code usages, it’s now much faster as it can ask you to make this decision before the actual search. (To use this, turn off Settings | Editor | General | Refactorings | Enable in-place mode.)

Ninja and other generators in CMake

Ninja Gen

Support for the new CMake File API lets CLion 2019.3 enable various CMake generators (requires CMake 3.15 or higher). Previously, only Makefiles were supported, now users can select Ninja, Xcode, Visual Studio, etc.

This works for all platforms, in remote mode, and with WSL.

Learn more

CMake Defaults

CMake Defaults

To simplify the configuration process for your new CLion projects, you can now configure one or more default CMake Profiles, which will be used for all your new projects. Use File | Other Settings | Settings for New Projects…

Other CMake support improvements

  • It’s now possible to reload CMake valid configurations even if some others are failing.
  • CMake 3.15 is bundled in CLion 2019.3.
  • If your compiler doesn’t support the -fpch-preprocess flag, your project will still be successfully loaded in CLion 2019.3. Check out the details in this blog post.

Debugger

remote gdb

Remote GDB Server

If you want to debug an executable on a remote machine from a locally running CLion, you can now use the Remote GDB Server configuration. CLion will upload the executable and launch your program under gdbserver, so there’s no need to do it manually anymore.

Learn more

lldb_printers

LLDB 9 and better pretty printers

In CLion 2019.3, the bundled LLDB on macOS and Linux was updated to v9.0. Besides this, a major clean-up was performed in the bundled LLDB pretty printers, fixing a whole set of related issues.

See how libc++ and libstdcxx are now handled on macOS and Linux

lldbinit

Read .gdbinit/.lldbinit from the project root

If you want to customize the GDB/LLDB debugger behavior on a particular project, you can now do so in CLion, as it supports reading the settings file from the project root directory.

Note that to enable this behavior, you have to explicitly allow it in your home file. See how to do this for LLDB and GDB.

C++20’s Concepts

Clangd-based code completion

One of the biggest features coming in C++20 is definitely Concepts. By collaborating with the author of Concepts support in Clang, we’ve brought Concepts to CLion 2019.3. The support covers not only code parsing and highlighting (which is done by the Clangd-based language engine), but also comes with:

  • The Unused Concept inspection.
  • Code completion including completion for types constrained by std::is_base_of<MyBase, T> and std::is_same<Other, T>.
  • The Rename refactoring.
  • Go to Definition and Find Usages.

Learn more

Code Analysis

virtual call

Virtual functions called from constructors / destructors

To prevent situations where virtual functions access resources that are not yet initialized or have already been destroyed, CLion gets a new inspection which detects virtual functions called from constructors or destructors.

Spelling in Doxygen

Spell Checker

The Spell Checker is useful for keeping the code accurate and readable. CLion has had it for C/C++ code for a long time. In v2019.3 we’ve enabled it in CMake and Doxygen comments.

Code coverage

Coverage

If you’ve ever asked the question, “Was this statement executed during the configuration run?”, that means you are looking for statements coverage measuring for your code. CLion 2019.3 has it thanks to the integration with llvm-cov/gcov tools.

You can get it for unit tests run or a regular configuration run. The results are available in the Coverage tool window or via a color indication in the editor’s left gutter.

Learn more

Editor

Go to Header/Source action

Go to Header/Source action

A new action to switch between header/source files was added. It’s more accurate and quicker for many C/C++ cases than Go to Related Symbol.

If multiple options to navigate to are identified within 500 ms, CLion shows an interactive popup where new items are added and you can select where you want to navigate to.

There is also a built-in mechanism to remap the shortcut from Go to Related Symbol to this new action, should you want to.

Learn more

Microsoft

Microsoft formatting and naming rules

In CLion, you can configure a set of formatting options and naming convention rules. Or, alternatively, you can inherit these settings from one of the predefined styles. In CLion 2019.3, we’ve added Microsoft’s predefined formatting and naming style to the list.

WSL2

WSL2

Windows Subsystem for Linux provides a convenient way to develop on Windows for Linux target platform. CLion natively supports the WSL environment and now comes with support for WSL version 2. The configuration process in CLion is completely the same for WSL v1 and WSL v2!

Learn more

Rust plugin update

Rust

One of the biggest updates for IntelliJ Rust is the initial support of cfg attributes. Now, the conditionally disabled blocks are grayed-out and excluded from resolve and code analysis. Among the supported cfg options are unix, windows, and target_os.

The widely used quick-fix, Auto-import for unresolved symbols, now works automatically when you call Implement members, Specify type explicitly, Add remaining patterns, and other code generation actions.

Other changes include Code Coverage for your Rust code, which has been a part of the plugin for a few releases already, handy interactive inlays for type hints, and include! macro support.

Other changes

  • VCS support: the Clone dialog (VCS | Get from Version control) was reworked. Now you can log in from the dialog, or if you’re already logged in, the IDE will instantly preview the lists of all repositories grouped by accounts or organizations.
  • A new option to make the scrollbars more visible was added – Settings | Appearance & Behavior | Appearance | Use contrast scrollbars.
  • A lot of UI issues were addressed in the updated JetBrains Runtime.

What's New in CLion 2019.2

Embedded Development

Debug with GDB Server

On-Chip debugging with GDB Server

If it’s possible to debug on the microcontroller of your choice with a GDB Server, you can now do it from CLion using a special Embedded GDB Server Run/Debug configuration. It covers OpenOCD, ST-Link GDB Servers, Segger J-Link GDB Server, QEMU, and many other specific GDB Servers.

Create a configuration, providing a path to GDB Server, arguments to run the server, and other appropriate settings, and you are all set and ready to debug on-chip from CLion!

Peripherals

Peripheral View for ARM Devices

When debugging on-chip, it’s crucial to have the ability to view the peripherals. In CLion, this view is now available for two types of Run/Debug configurations: Embedded GDB Server and OpenOCD Download & Run. In both cases, a Peripherals tab appears in the debug tool window when you start debugging. Load the appropriate .svd file for your board and select the active peripherals you need to see.

Learn more

Debugger

Line breakpoints

Pending, resolved, and invalid breakpoints

CLion 2019.2 now distinguishes three types of line breakpoints:

  • Pending: Line breakpoint is out of the debugging session, which means the session hasn’t started yet or the corresponding shared library hasn’t been loaded yet).
  • Resolved: Line breakpoint is successfully resolved by GDB or LLDB using the provided debug symbols, and can be hit during the execution.
  • Invalid: Line breakpoint can’t be resolved by GDB or LLDB and can never be hit.

The types are detected automatically on the fly and the breakpoint icons are updated accordingly.

Debugger commands completion

Completion for GDB/LLDB commands

If you prefer the command line interface of GDB/LLDB and use the debugger console available in the debug tool window, you will benefit from completion for GDB/LLDB commands. Use Tab or Ctrl+Space to invoke it.

This completion is powered by GDB or LLDB, respectively; CLion simply gives you access to the suggestions.

MSVC debugger

An experimental debugger for the MSVC toolchain

If you use the Microsoft Visual C++ toolchain in CLion, now you can try a new experimental debugger.

It’s implemented by the JetBrains team on top of LLDB and is bundled into CLion. To enable bundled support for native visualizers, use Settings | Build, Execution, Deployment | Debugger Data Views | Enable NatVis renderers for LLDB.

An experimental debugger is available when turned on explicitly: call up the Maintenance dialog (Shift+Ctrl+Alt+/) | Experimental features, and select cidr.debugger.lldb.windows to control it.

Learn more

Memory View

When debugging your application, you can easily review the memory behind a pointer: in the Variables view of the debug tool window, press Ctrl+Enter on a pointer to invoke the Memory View. In 2019.2, we’ve updated the Memory View to make it even more useful.

Go to address

Go to address

Navigate to a particular address in memory from the Memory View. Use the hex value representing an address, a pointer variable, or call the address (&) of any variable you are interested in.

Code completion will assist you with the known symbols.

ASCII view

ASCII View

If you are interested in the ASCII memory format, you’ll find the ASCII view in the column on the right of the Memory View useful.

Parameter hints

Parameter Name hints

Thanks to parameter name hints in v2019.2, you can avoid switching to the function signature while exploring a function call. This in turn should help increase the code readability.

For function calls, lambdas, constructors, initializer lists, and macro expressions, CLion shows the names of the parameters for the passed arguments. This works if an argument is a literal or an expression with more than one operand.

Learn more

Code analysis

Unused Include

Unused Includes

The ‘unused includes’ check is back and completely reimplemented on top of the Clangd-based engine. It suggests 3 detection strategies: a conservative one, an aggressive one, and the default one (Detect not directly used) which is the closest to the “Include What You Use” principle.

Learn more

Clang-Tidy

Clang-Tidy update

The Clang-Tidy bundled binary was updated to the newest version, which brings a set of new checks to CLion. This includes some new abseil-* checks, a few from the clang-analyzer-* group, several new modernize-* checks, and more.

Code assistance for .clang-format files

Since v2019.1, CLion has support for ClangFormat as an alternative formatter tool. Now, if you have customized your .clang-format config files in the project, you can benefit from code assistance when you update them.

Learn more

Quick Doc

Quick Documentation

To learn about any particular option, call the Quick Documentation popup (Ctrl+Q) and read the original documentation with samples.

ClangFormat config inspection

Schema validation inspection

CLion validates the content of your .clang-format config file against the built-in JSON schema. If the option’s value doesn’t match the allowed value set, a warning will be shown.

ClangFormat completion

Code completion

When customizing the .clang-format config file, you can benefit from code completion working for both options and their values.

ClangFormat doc

Options description in completion

Code completion popup for option names also includes a short description of the option, so you can quickly check it while typing the option name.

Naming convention

Naming settings

New settings

The naming convention settings (Settings | Editor | Code Style | C/C++ | Naming Convention) were reworked to provide better flexibility and more opportunities. New settings like Visibility (Public, Private, or Protected) and Specifier (Const or Static) were added. We’ve also updated the rules to address several kinds of entities at once.

It’s possible to work with the new UI without using the mouse.

Leading Snake Case

Leading snake case

As requested by CLion users, a new style – Leading_snake_case, which capitalizes only the first letter in the snake_case name, leaving the rest in lower case – is now available, along with the somewhat similar Upper_Snake_Case style and others.

Shell Script plugin

Shell Script plugin

If you need to edit shell scripts while you are working on your C++ project, you can do this with CLion as it now bundles the Shell Script plugin.

You can benefit from code highlighting, word and path completion, and even textual Rename.

Syntax highlighting for new languages

Ruby syntax highlighting

CLion provides bundled profound support not only for C and C++, but also for Python, JavaScript, XML, and more, as well as providing plugins for Rust, Swift, and Kotlin/Native.

Have code in your project in other languages, such as PHP, Ruby, or C#? You’ll be happy to learn that syntax highlighting is now available in CLion for over 20 different programming languages!

Learn more

VCS: Commit from the Local Changes

Commit from Local Changes

You can now commit directly from Local Changes tab. Just enable the “Commit from the Local Changes without showing a dialog” option at Settings | Version Control | Commit Dialog.

Use the Commit shortcut (Ctrl+K) and the IDE will select the modified files for the commit and focus on the Commit message field in the Local Changes tab of the Version Control tool window.

Learn more about other VCS changes

Performance improvements

There is some huge ongoing work in CLion to improve the IDE’s performance such as indexing, responsiveness, and elimination of freezes, among others. Part of this work is already included in v2019.2:

  • The in-place Rename refactoring was reworked to eliminate lags and freezes.
  • The performance of code completion for qualified expressions in the editor has been significantly improved.
  • Collecting compiler information and thus loading the CMake step in remote cases was accelerated by reducing the number of I/O operations.
  • CLion now warns you when Windows Defender is affecting the build performance and is able to automatically exclude directories from real-time scanning.

Rust plugin update

Rust plugin

Another huge update for the Rust plugin brings a new experimental macro expansion engine. You can turn it on in Settings | Languages & Frameworks | Rust | Expand declarative macros.

This engine provides you with code insight features such as highlighting, name resolution, and completion for generated modules and methods from impl blocks. Besides this, it enables navigation in the macro calls.

Other changes include a Duplicate code fragments inspection for Rust, and other new quick-fixes and inspections.