CLion 2021.1 is enhancing the code analysis experience by upgrading Data Flow Analysis to global mode, expanding MISRA support, and integrating with Clazy for Qt projects. In the debugger, GDB and LLDB have reached feature parity for Core Dump debugging. And finally, remote mode has a wider range of abilities and works consistently across several project models.
Data flow analysis (DFA) tracks the flow of data in your code and detects potential issues based on that analysis. In addition to the local DFA (which works within a single function), CLion 2021.1 includes global DFA (which takes a whole translation unit of a program as a single unit for analysis). Global DFA not only enriches the already existing checks but also adds several new unique inspections.
The list of current DFA-based inspections that benefit from global DFA includes:
A few new inspections have been added that only make sense when analyzing globally – running DFA on a whole translation unit of a program:
CLion 2021.1 also optimizes many steps in DFA. The performance measurements on Postgres, Eigen, and Clangd projects, among others, show that the overall performance is good and that some characteristics have improved (such as the number of files where DFA execution was terminated by CLion because of a timeout).
In addition to line coverage, CLion 2021.1 can now also calculate Branch Coverage. This method takes into account all the branches of each control structure. Run your CMake application or tests with coverage and check out the new column that’s been added to the Coverage tool window.
Branch coverage is enabled by default and can be adjusted in Settings | Build, Execution, Deployment | Coverage, but it only works with GCC/gcov or version 12.0.0 and higher of LLVM/llvm-cov.
In order to reach feature consistency across all toolchains, project models, and configurations, CLion 2021.1 makes it possible for Google Sanitizers, Valgrind Memcheck, and Code Coverage to work with remote toolchains.
CLion 2021.1 adds more checks from MISRA C 2012 and MISRA C++ 2008. The full list is maintained on our confluence page and allows you to easily track the progress.
Postfix code completion for C and C++ lets you add code around an expression you’ve just typed. It can wrap an expression with a frequently used language construct, or pass the expression as the first argument of a free function.
Postfix templates can help you with common language constructs. Type an expression then a dot, and then add the postfix template abbreviation and press the expansion key, or select the required template from the completion list that appears. The expanded template will wrap the given expression. Find the full list of templates in Settings | Editor | General | Postfix Completion.
Use postfix code completion to pass the expression you’ve just typed to a free function as the first argument. Type an expression, then a dot, and select a free function from the completion list that appears.
CLion 2021.1 allows you to work with Makefile projects on a remote machine. Change the toolchain in the Makefile settings to a remote one, then reload the project and it will synchronize with the remote machine. Compile, run, and debug your application remotely from your locally running CLion.
The Makefile Language plugin (previously 3rd-party) is now maintained by the CLion team and comes bundled in CLion. The plugin provides make syntax highlighting, quick documentation, Find Usages for targets, and a variety of navigation and code completion actions for Makefile.
CMake Profile settings in CLion are now stored in a cmake.xml file in the .idea directory and can be shared in the VCS along with the project. Simply select the Share option in Settings | Build, Execution, Deployment | CMake.
CLion 2021.1 bundles CMake 3.19. In addition to the other changes it introduces, this is the first CMake version to support Apple Silicon (M1 chip).
CMake 3.19 features for CUDA are now supported in CLion, which includes autocompletion for a few new CMake variables.
Clazy, a Qt-oriented static code analyzer, is now integrated into CLion’s Clangd-based engine. CLion currently uses version 1.8. Checks are displayed in the editor and quick-fixes are also available.
Users can configure CLion’s severity level and the level of the Clazy checks in Settings | Editor | Inspections | C/C++ | General | Clazy.
For those used to the key bindings in QtCreator, CLion now bundles the QtCreator keymap. You can switch to it in Settings or via a Quick Switch Scheme action (Ctrl+`).
The Set Execution Point action lets you jump to an arbitrary line of code in the editor during a debug session and set the execution point there, skipping all the other commands in between. It now works in the disassembly view, so you can move the execution point while stepping through the assembly code.
When debugging core dumps in CLion 2021.1, users can now set sysroot in the corresponding run configuration. This will help localize library symbols when debugging core dumps from binaries built on other systems.
Explicitly setting symbol files when debugging a core dump for non-symbolized binary with LLDB now also provides necessary information about the symbols to CLion. With this fix, GDB and LLDB have reached feature parity for core dump debugging in CLion!
A new Tools | Open Remote Host Terminal action opens the project directory on the remote host if it exists. The remote host corresponds to the remote profile that is currently selected, or if a local one is selected, the first remote profile found in the 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.
CLion can inspect your code before you commit it to help you make sure there are no bugs. Choose a code inspection profile before committing changes to VCS – click the gear icon to display the commit options, select the Analyze code checkbox, click Choose profile, and select the desired profile.
You can create a custom commit message template in Git and CLion will display this text as an initial commit message.
A new Save to Shelf action allows you to copy your changes to the Shelf while keeping them in the local changes. You can access this action by pressing Ctrl+Shift+A and typing ‘Save to Shelf’.
Learn more about other VCS improvements across all IntelliJ-based products.
IntelliJ Rust now provides a structured view for the compiler’s build output. The tab opens automatically in the Build tool window when you call a Cargo command that includes a build step. This new feature works with Cargo versions 1.48.0 or later.
Another significant update is the new Change Signature refactoring. It helps you modify a function/method signature, affecting all references. You can quickly change a function’s name or return type, reorder or add/remove parameters, and add an async or unsafe prefix.
The Rename refactoring now gives renaming suggestions for elements like structs, functions, and local variables when you change a name in the editor.
Conditional compilation support has been improved. Find Usages is now available for
Cargo features, and completion works for the feature
argument in the
cfg
and cfg_attr
attributes. Also, if there are nested attributes
inside cfg_attr
, the plugin takes that into account during name resolution and
code analysis.
Code With Me, a new JetBrains service for collaborative development and pair programming, is now bundled with CLion.
Set the required level of access to your project and share the link with your guests. Your peers do not even need to have an IDE of their own installed to collaborate with you. Embedded audio and video calls, along with chat messaging, will help teams discuss the code, share their knowledge, and cooperate more efficiently.
To learn more about the availability of Code With Me with your current JetBrains license, check out the pricing page.
The Space plugin is now available for CLion. You can connect to your organization in JetBrains Space via Get from VCS, located right on the welcome screen. Once logged in, you can view and clone project repositories, review your teammates’ code, and write Space Automation scripts.
CLion 2020.3 brings significant, eagerly anticipated improvements to key parts of the development process – code analysis, running and debugging applications, and unit testing. For embedded projects, CLion now comes with initial MISRA C and C++ support. And Qt users can benefit from IDE features tuned specifically for working with Qt code.
CLion 2020.3 can run and debug your application with root privileges – you just need to select this option in the corresponding Run/Debug configuration. This works for CMake, Makefile, Gradle Native, Custom Build, and CTest applications.
A new Run | Open Core Dump… action available for Linux and macOS allows you to open an existing core dump of a crashed process in CLion and debug it there. Users can inspect the frames and variables view, check the memory and disassembly view, evaluate expressions, and run debugger commands from the debugger console. Read more about this feature’s configuration process and known limitations.
With a new Set Execution Point to Cursor action, you can move back and forth
though your program’s execution while debugging, break loops or restart them,
select another branch in an if-else
clause or switch-case
statement, and even skip loops completely. It is as simple as dragging-and-dropping
an arrow in the gutter to the line you are interested in.
Now when the application is running in debug mode, the editor displays clickable inline hints that you can expand to see all the fields belonging to a given variable. Moreover, you can change the variable values inside the drop-down list or add an arbitrary expression as an Inline Watch to this place in the code.
In CLion, you can now use a script to specify the environment in which a Run/Debug configuration will be launched. You'll find the new setting for this in all Application and Unit Testing configurations.
No more waiting! Run/Debug configurations can be edited while the project is being indexed.
CTest, a CMake-specific test runner, is now supported in CLion. This means the list of tests that are run with CTest is detected, and the IDE automatically creates run/debug configurations for them. When tests are launched, the results are presented in the built-in test runner, from which you can debug tests, rerun only failed tests, and much more.
Version 2020.3 enhances CLion’s support for Google Test, the most popular C++ unit testing framework in the world (Developer Ecosystem Research in 2020 shows that 31% of C++ developers use Google Test).
DISABLED
prefix in their names) are now also shown
in the test tree with the corresponding icon.
CLion 2020.3 brings partial support for MISRA C 2012 and MISRA C++ 2008, guidelines used widely in embedded development and especially in the automotive industry. This support speeds up the development of such projects by revealing incompatibilities earlier in the development cycle. The list of currently supported checks is available on CLion’s Confluence page.
CLion 2020.3 improves the Unused Value inspection, which catches situations where a variable value is never used after it has been assigned. It can now also be tuned to follow the style that recommends using default variable initializers. A new option to turn the inspection off in such cases has been added to the settings.
A new Extract Lambda Parameter refactoring has been added to CLion. It extracts an expression or statement into a new parameter with a lambda expression passed as a corresponding argument. The statement could, for example, be a comparator passed to a sorting function.
Clang completion snippets help you insert common constructs when C++ keywords are typed.
In some cases, when completing a typedef
keyword, for example, code completion
can suggest not only the keyword itself but also stubs for the type and the new name.
CLion 2020.3 improves code completion, as it now works much more accurately with template types. For example, completion options are displayed for container elements and iterators in the function template.
The New Project dialog suggests the Qt Console Executable and Qt Widgets Executable project types. You can also select the Qt CMake prefix path, the C++ language standard to be used in the project, and the Qt version. The new project is generated using the corresponding templates.
A new QT UI Class item in the New menu (Alt+Insert) helps you
simultaneously create a Qt class along with a .ui file. Fill in the class name
and select the parent class (QWidget
, QMainWindow
, or
QDialog
). .h/.cpp/.ui files will be generated using the Filename base
as their file names. The generated files follow the templates listed
in Settings/Preferences | Editor | File and Code Templates – Qt Class,
Qt Class Header, and Qt Designer Form.
Signals and slots are central features of Qt, as they are the entities used for communication between objects. CLion now understands when signals or slots have to be completed, and it filters only the corresponding members in the completion dropdown.
Auto-import suggestions in Qt projects in CLion 2020.3 are tuned to follow the most commonly used style for Qt.
Makefile projects using various wrappers like ccache, libtool, dolt, slibtool, and jlibtool can now be successfully loaded in CLion. Read more about some of the limitations that remain.
Setting up a Makefile project in CLion is now even easier – the Run/Debug configurations are created automatically for the targets in the top-level Makefile when loading the project. Now to run and debug, you just need to point the configuration to the built executable.
The Recompile action (Ctrl+Shift+F9) helps speed up the development process by compiling a single file without building the whole project. It now works for Makefile projects, too!
With CLion 2020.3, it’s now possible to keep several CMake profiles configured in CLion while disabling the ones that are not currently in use. This improves the project loading times and saves from the redundant failures from temporarily unavailable profiles (like for the remote configurations which are currently shut down). The option is available from the CMake tool window and the CMake Profiles settings dialog.
The Search Everywhere dialog now includes a Git tab. It helps with finding commit hashes and messages, tags, and branches. You can also perform simple mathematical calculations in the search field.
The VCS menu is now named according to the version control system in use. We’ve made the menu more concise, removing all but the most useful actions for versioning your project.
Additionally, now the two most popular buttons – Commit and Commit and Push… – are explicitly shown on the Commit screen.
You can now stage changes directly from CLion. To enable this feature, go to Preferences/Settings | Version Control | Git and tick the Enable staging area checkbox. Click the + icon to add your files to the new Staged node in the Commit view. You can also stage changes right from the gutter or in the Diff view. To learn more, read our blog post.
Directories marked as Excluded locally are now automatically marked as Excluded paths for remote toolchains when they are initially being configured. And when changes are made to an already synchronized project, CLion shows an update notification and suggests updating the list of Excluded paths.
CLion 2020.3 supports Code With Me (EAP), a new service from JetBrains for collaborative development and pair programming. Code With Me enables you to share the project you currently have open in your IDE with others, and work on it together in real time. You can download it today from the plugin marketplace (Preferences / Settings | Plugins | Marketplace). Check out these posts to learn more about Code With Me.
CLion 2020.3 gets a revamped Welcome screen. The new layout puts the most common operations at your fingertips and gives you immediate access to recent projects, customization options, and plugin settings.
It’s now possible to split an editor by dragging and dropping a tab to the side of the main editor window. The Open in Right Split action splits the editor vertically upon opening a file.
You can invoke the action from the Project view or from other navigation popups, such as Recent Files and Search Everywhere (Shift+Enter).
CLion can now synchronize with your OS theme. To enable this feature, go to Settings / Preferences | Appearance & Behavior | Appearance and tick the Sync with OS checkbox. Click the gear icon next to Sync with OS to select your preferred theme.
IntelliJ Rust now fully supports Cargo features and allows you to configure them with a smart new UI. Features of a workspace can be toggled on and off with a single click, and the plugin’s code assistance will take these settings into account. Check out the details in this blog post.
Also, the plugin now allows using Rustfmt as the default code formatter. Just set the corresponding checkbox in Settings / Preferences | Languages & Frameworks | Rust | Rustfmt, and the whole file reformatting will employ Rustfmt. For now, if you call Reformat Code on a selection, the IDE’s formatter will be used instead.
The plugin’s project wizard has been enhanced with more templates and the option to use custom cargo-generate templates.
Other updates include the introduction of WebAssembly project support and a new experimental engine for name resolution.
CLion 2020.2 ensures that a variety of C++ projects are covered by adding Makefile projects and polishing CMake support. It provides better C++20 standard compliance. Code analysis is now more accurate and catches more critical errors, like dangling pointers. Unit testing, code coverage, embedded development, and other areas were also significantly enhanced.
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. Check out the details, known
limitations, and a long list of projects we’ve tested our approach with in this
blog post.
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:
CLion now bundles CMake 3.17 and adds initial support for two of its most recent features:
-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).
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.
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 in CLion 2020.2 got a massive update, increasing the accuracy of many checks and covering more cases. This version also continues the work of polishing the Data Flow Analysis, reimplemented previously on top of the Clangd-based engine.
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.
The Simplify code inspection is now more accurate and covers more cases. It works for the following types of statements:
condition == true.
condition1? true : condition2.
if(condition1) return true; return condition2;
The cases can be configured separately in
Settings
| Editor | Inspections | C/C++ | General | Simplifiable statement
.
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.
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.
Last but not least, we’ve introduced a new Inspection Widget. It 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).
If you click on the Inspection Widget, the Problems View tool window will open
(View | Tool Window | Problems
).
It shows the list of warnings and errors in the current file, helps you navigate to the
place in your code where the problem was encountered, and allows you to fix the issues by
invoking the Alt+Enter shortcut right from the tool window.
This year officially brings a new language standard to C++ developers, and CLion already comes with support for many of its features. The language engine in CLion 2020.2 is also generally more stable on C++20 code.
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
Code completion in designated initializers now works for fields from a base class.
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.
for
with initializer
Range-based for
loops with the init
statement are now supported.
This includes refactorings like Rename for variables in the loop.
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.
These types of tests in Catch2 are now recognized and handled just like the other test types.
The GTEST_SKIP()
macro in Google Test provides the ability to skip tests at
runtime. This is now supported by CLion.
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
.
For embedded development, we’ve updated a plugin for PlatformIO, bringing significant improvements:
PlatformIO project configuration files are now highlighted properly, so you can read and update them more easily.
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.
CLion now automatically creates CMake Profiles for the
CMAKE_CONFIGURATION_TYPES
entries in the PlatformIO CMake project.
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.
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.
The Go to Declaration or Usages action (Ctrl+Click / Ctrl+B) behaves differently depending on the case and the IDE settings:
Settings
| Editor | General | Go to Declaration or Usages
.
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.
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
. Learn more in this blog post.
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 Visual Studio toolchain to debug Rust code built on 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.
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.