Early Access Program News

CLion 2019.3 EAP: C++20’s Concepts, Go to Header/Source, and .lldbinit

Hi,

A new CLion 2019.3 EAP (build 193.5096.27) is now available! Get it from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). A patch-update for anyone using the previous EAP build will be available shortly.

DOWNLOAD CLION 2019.3 EAP

Key highlights:

Support for C++20’s Concepts in CLion

Concepts are one of the biggest and most important features coming in the C++20 standard. We’ve been collaborating with Saar Raz, the author of the Concepts support in Clang, and have merged his Clang branch into our custom Clangd-based language engine in CLion, and implemented a few things on top:

  • Parsing and custom highlighting
  • Code inspections, like Unused Concept
  • Code completion
    • Completions on template type parameters that are constrained
    • Completion for types constrained by std::is_base_of<MyBase, T> and std::is_same<Other, T>
  • Refactorings and navigation actions for Concepts
    • Rename
    • Go to Definition
    • Find Usages

Concepts completion

To learn more about CLion’s support for C++20’s Concepts, please see our dedicated blog post.

Action to switch between header/source files

To switch between header/source files, CLion has offered Go to Related Symbol. This IntelliJ platform action is smart as it tries to find related symbols across the whole project, but it may also cause some issues and inaccuracies when used for switching between header/source use case:

  • It tries to locate the cursor in the newly opened file on a related class/function definition, which is often inconvenient.
  • It tries to find the best option and just goes there without asking the user to select from the available options (this often causes issues for cases with one header plus many source files, or a .h/.inl/.cpp triple).
  • Because it tries to be so smart, it might be heavy in terms of performance (as it looks through all the project symbols).
  • Several heuristics exist which could be quicker and superior in many situations when switching between header/source. None of them is used by this general Go to Related Symbol action.

To address these issues, we’re introducing a new "Go to Header/Source" action:
Go to Header/Source

As you can see, it either opens a file in the editor right away or shows the popup with various options. This action uses a few heuristics for the search:

  1. The most recent switched file is always at the top of the list.
  2. Next goes the file with the matching name from the same directory, if any (for example, myfile.h / myfile.cpp).
  3. Then, a definition/declaration-based search is performed in the background (which looks for files with definitions with matching declarations in the current file, and vice versa), and new items are added to the popup.
  4. Note that the search is currently limited to direct includers/includees so as to avoid interference from the same symbols from different targets.
  5. If no single destination is found within 500 ms, CLion shows an interactive popup where new items are added and you can select where you want to navigate to.

There’s one last thing worth mentioning. We understand that CLion users mostly use Go to Related Symbol as a Go to Header/Source action and might be accustomed to this shortcut. From now on, if you invoke Go to Related Symbol via the keyboard shortcut in a C/C++ file, and the non-default shortcut is not yet set for Go to Header/Source, CLion will ask you – only once per installation – if you’d like to remap the current shortcut from Go to Related Symbol to Go to Header/Source:
Remap the shortcut

LLDB: read .lldbinit from the project root

We’ve recently added an ability to read .gdbinit from the project root. It’s now time to enable it for .lldbinit as well.

You may find this useful to tune the LLDB debugger behavior via passing some commands and options in a .lldbinit file. Note that to enable this behavior, you have to explicitly allow it in your home .lldbinit file. Please see this for the exact commands.

Full release notes are here.

DOWNLOAD CLION 2019.3 EAP

Your CLion Team
JetBrains
The Drive to Develop

image description

Discover more