Quantcast
Channel: CLion : A Cross-Platform IDE for C and C++ | The JetBrains Blog
Viewing all 678 articles
Browse latest View live

CLion 2019.2 EAP: fixes for Debugger and Parameter hints

$
0
0

Hi,

A new CLion 2019.2 EAP (build 192.5281.33) is now available. Download the full build from our site, install it via the Toolbox App, or use a snap package if you are using Ubuntu. A patch-update for the previous EAP build will be available shortly.

DOWNLOAD CLION 2019.2 EAP

Parameter Name Hints

The first 2019.2 EAP introduced Parameter name hints that helps with the code readability by showing the names of function parameters for passed arguments. This build brings a few important fixes for it:

  • Fixed the freezes in the IDE caused by parameter hints (CPP-16494).
  • A parameter name hint was added for an argument which is a constructor without parameters (CPP-16423):
    constructor_hints
  • A parameter name hint was added for the this pointer (CPP-16312):
    this_hints

Debugger

This EAP also brings a set of fixes in Debugger:

  • Fixed the bug with the evaluate an expression with GDB. It gets constantly re-evaluated each time the debugger refreshes the variables view (CPP-7358).
  • Fixed the issue with GDB when a variable’s value is not updated on stepping after “Set value” command (CPP-13295).
  • Fixed the GDB hangs in the case of MinGW-w64 and multi-line commands(CPP-9090).

And more

Among the other changes:

  • Commit from the Local Changes for projects that use Git or Mercurial as their version control system (see the blog post for more details).
  • Windows Defender performance warning (see the blog post for more details)
  • Remove false positives with constructors marked as unused, if created via std::make_shared.
  • Fixed the issue with the macro replacement in quick documentation which was not working when ClangFormat is enabled(CPP-16244).

The full release notes are available here.

Your CLion Team
JetBrains
The Drive to Develop


CLion 2019.2 EAP: MSVC Debugger, Unused Includes Check, and More

$
0
0

Hi,

A new CLion 2019.2 EAP (build 192.5438.15) is now available. Download the full build from our site, install it via the Toolbox App, or use a snap package if you are using Ubuntu. A patch-update for the previous EAP build will be available shortly.

The main highlights:

DOWNLOAD CLION 2019.2 EAP

Experimental feature: Debugger for the Microsoft Visual C++ toolchain

For a long while, it’s been possible to use Microsoft compiler in CLion if you had the Microsoft Visual C++ toolchain installed on your Windows machine. However, the debugger was not available in CLion. This is because the Microsoft debugger is proprietary and cannot be used outside of Microsoft tools.

Now CLion is going to ship with an experimental debugger for the Microsoft Visual C++ toolchain!

‘Experimental’ means it’s limited and still has some major issues, listed below. So it’s definitely not release quality yet. We do encourage you to try and give us your feedback. This will help us identify how we can improve its functionality for you.

How to enable it?

As the debugger is experimental for now, you need to explicitly turn it on to use it. Call up the Maintenance dialog (Shift+Ctrl+Alt+/ on Linux/Windows, ⌥⇧⌘/ on macOS) | Experimental features, and select cidr.debugger.lldb.windows to control it.

Now, when you select the Visual Studio toolchain in CLion, the debugger is available:
msvc_toolchain

Known issues and diagnostics

As the feature is still in progress, here is a list of known issues, so please consider them before submitting any additional ones.

Native visualizers
For the Visual Studio C++ toolchain, STL native visualizers are taken from the Visual Studio installation. To enable them, use Settings | Build, Execution, Deployment | Debugger Data Views | Enable NatVis renderers for LLDB. Note, you can configure the proper diagnostics level here. Possible options are Disabled, Show only errors, or Verbose. (To report an error with renderers to our issue tracker, please select Verbose.)
msvc_settings

Not all of the STL types are rendered correctly in CLion (CPP-16661):

  • The following containers mostly work (in basic cases): string, list, vector, deque, array, stack, queue, priority queue, unordered_mutlimap, unordered_multiset, unordered_set, and unordered_map.
  • The following containers do not work: forward_list, map, set, multimap, and multiset.
  • Nested visualizers in containers are not yet supported.
  • There are a few known issues with the rendering of smart pointers in some cases.

By the way, if you have any custom native visualizers in your project, CLion will use them as well:
in_prj_natvis

Other known issues:

  • Data breakpoints are not yet supported.
  • Exception handling:
    • Break on exception throw/catch is not yet supported.
    • Stepping through the exception blocks has issues.
  • Target output may not be flushed on breakpoint hit.
  • Force step into the assembly code without debug symbols is not yet supported.
  • Thread names are not rendered.

How it works

The debugger is implemented by our team on top of LLDB. Even though we’ve upstreamed many changes introduced by this effort, there are still some things that are not available in the LLVM public repository. That’s why we bundle the proper version of custom LLDB within CLion.

What about LLDB on Windows in general?

Since the newly implemented debugger is based on LLDB, it’s reasonable to request it in other cases on Windows as well. Well, guess what? It is there! LLDB for MinGW is also present when the experimental feature is turned on.
mingw_toolchain

The implementation is also experimental as many standard containers and types are not rendered properly for now. For example, array and string should work fine, but for the rest of the standard containers there are some issues (monitor CPP-16660 for more details).

The ‘unused includes’ check is back

Since its launch, CLion has had a code check that detects and marks unused #include directives. However, some time ago we disabled it by default (in Settings / Preferences | Editor | Inspections | C/C++ | Unused code | Unused include directive) because of the many false positives.

Now the check is completely reimplemented on top of the Clangd-based language engine and is, again, enabled by default!
unused_incl_results

Note that if you disable the Clangd-based engine in CLion (which we do not recommend, as the engine not only speeds up code highlighting and other code assistance features, but also provides more accurate code errors and warnings), then the unused includes check will simply follow the old behavior.

Diagnostics strategies

There are several strategies you can follow to detect the unused or not required #includes directives and remove them:

  1. Detect completely unused: the most conservative strategy, which detects only the #includes directives with the declarations never used in the whole translation unit at all.
  2. Detect not directly used: this strategy follows the “Include What You Use” principle and detects the #includes directives with the declarations not used in the current file directly.
  3. Detect not required: the most aggressive strategy which detects the minimal subset of the #includes directives to keep the file compilable and suggests removing all the rest.

You can switch between the strategies in the inspection settings. By default, Detect not directly used is selected:
unused_incl_settings

How it works

To avoid false positives, we’ve set a few rules in the newly implemented inspection algorithm.

First, you can enable or disable running the inspection in the header files (by default, it’s disabled). If you decide to run the inspection in headers, then the “Umbrella headers” rule will be used. “Umbrella headers” are used to include all the necessary headers at once and contain no declarations at all. The inspection naturally doesn’t work for such headers.

Second, the source files with compilation errors will never get unused #includes directives – all directives will be considered used.

Finally, the inspection only checks the headers with #pragma or header guards. If none of them are present, the header will be always marked as used.

Memory view: ASCII view

CLion’s Memory view is improved in this EAP build. Earlier in 2019.2 EAP, we added Go to address. Now, behold the ASCII view:
mem_view_mingw

Better performance for code completion

Completion for qualified expressions has been significantly improved (CPP-16406). The boost is especially noticeable in LLVM project.

The full release notes are available here.

DOWNLOAD CLION 2019.2 EAP

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.2 EAP: Peripheral View for ARM Devices

$
0
0

Hi,

A new CLion 2019.2 EAP (build 192.5587.18) is now available. Download the full build from our site, install it via the Toolbox App, or use a snap package for Ubuntu. A patch-update for the previous EAP build will be available shortly.

DOWNLOAD CLION 2019.2 EAP

This build introduces the Peripheral view for ARM embedded devices.

What do you need to start with it in CLion?

The Peripheral view in CLion is shown during debugging for two types of Run/Debug configurations: Embedded GDB Server and OpenOCD Download & Run. So, first, you need to have a configuration. When you run it, you’ll see the Peripherals tab in the Debug tool window with an invitation to load the .svd file:
peripherals_load

Second, you need is an .svd file, which is a standard ARM file with the definitions of peripheral registers. MCU vendors publish them along with the chip documentation, or you can find them inside various SDKs or libraries.

Select the file and the active peripherals to show:
peripherals_select_active

That’s it!
peripherals_loaded

A few notes on the Peripherals tab

You can switch between Decimal, Octal, Hex, and Binary views of the peripheral value via the context menu:
peripherals_mode

Note the peripherals are read-only for now. We plan to implement a read-write mode later.

If you need to search for a particular value, just start typing the name:
peripherals_search

On the Peripherals tab, you can also find a few useful buttons:

  • The Stop refreshing button stops the on-the-fly updates to the peripherals on stepping. It can be useful if the operation is time-consuming. And with the Refresh button, you can trigger an update manually.
  • The Configure button opens the Load .svd file dialog. By the way, you can load several .svd files at once and select the active peripherals you need from each one.
  • Export as CSV to Clipboard and Open as CSV in Editor can be useful if you want to compare peripherals from several runs or save it for the future investigation.

Last but not least, this EAP build bundles GDB 8.3.

The full release notes are available here.

DOWNLOAD CLION 2019.2 EAP

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.2 Hits Beta

$
0
0

CLion 2019.2 goes Beta! To install CLion 2019.2 Beta (build 192.5728.28), download it from the website, update from our Toolbox App, get it through a snap package (if you are using Ubuntu), or use a patch update.

DOWNLOAD CLION 2019.2 BETA

blog@2x

Beta builds are much more stable than EAP builds, but some issues may still occur. If you find any issues, please report them to our issue tracker. You don’t need a license to use this build.

The main highlights:

  • The updated ‘Unused includes’ check no longer hangs in a batch mode (run via run inspection by name)
  • A fix for the issue with the freezing rename refactoring when invoked from the context menu (CPP-16768)
  • A fix for the code highlighting disappearing after a file was saved when the parameter name hints were enabled (CPP-16741)

The full release notes are available here.

Your CLion Team,
JetBrains
The Drive to Develop

CLion 2019.2 Release Candidate is Here

$
0
0

Hi,

Please welcome the Release Candidate for the upcoming CLion 2019.2!

To install CLion 2019.2 RC (build 192.5728.70), download it from the website, update from our Toolbox App, or use a snap package (for Ubuntu). Please note that to use CLion 2019.2 RC, you need to either have an active subscription or start a 30-day evaluation period. No patches are provided for this release candidate, but you can expect a patch from the latest 2019.1.4 update to the 2019.2 release version.

DOWNLOAD CLION 2019.2 RC

This builds brings some cosmetics updates to the recently added Peripherals View. We’ve also fixed some issues related to that view, like having to click the load button twice (CPP-16730) and some incorrect cells coloring in the table (CPP-16746).

In the 2019.2 EAP builds, we’ve enabled an experimental LLDB-based debugger for the Microsoft Visual C++ toolchain. It was also available for MinGW under the same experimental setting. However, while the debugger for MSVC is more or less stable and the improvement path is clear enough, for MinGW the quality was not satisfactory. We’ve decided to turn it off for now, even under the experimental setting, leaving only the MSVC debugger available.

The full release notes are available here.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.2 has landed with new functionality for Embedded Developers, experimental MSVC debugger, updated Unused Includes check, parameter hints, and much more

$
0
0

CLion 2019.2, the second big update this year, is here now! It brings improvements for Embedded Developers and adds more debugging abilities – including an experimental debugger for the Microsoft Visual C++ toolchain. That’s not all, there’s a fully-reworked Unused Includes check, enhancements in the editor, improved performance, and more.

CLion 2019.2 banner

To update to this version use the Toolbox App, snap package (on Ubuntu), our website, or the patch-update from the latest build of 2019.1.

DOWNLOAD CLION 2019.2

In brief, here are the main improvements:

Read on for the details or check out this short What’s New video by Phil Nash:

Embedded Development

Some time ago we started working on support for Embedded development in CLion. This release comes with a wide range of on-chip debugging abilities and a new Peripherals tab.

On-Chip debugging with GDB Server

For on-chip debugging you could use the OpenOCD debugger and configuration provided in v2019.1. Now it’s time for more debuggers! If your microcontroller supports debugging via a GDB server, you can now do it in CLion. This means that for OpenOCD, ST-Link GDB Servers, Segger J-Link GDB Server, QEMU, and many other specific GDB Servers, you can run them from CLion and benefit from the built-in debugging abilities CLion provides. All you need to do is to provide the settings in the newly added Embedded GDB Server Run/Debug configuration:
Configurations for Embedded

Configure the path to the custom GDB Server, GDB server-specific arguments (for example, port number or a board config file), and, if needed, working directory, environment variables, board reset command, and a startup delay.

Note, that similar to the OpenOCD Run/Debug configuration, this new configuration works only with the CMake-based projects for now. In the future, we plan to add the ability to launch these configurations for Custom Targets (CPP-16079).

A Peripheral View for ARM Devices

For ARM devices, there is often a specified Peripheral view described in the .svd file for your microcontroller type. CLion now provides a convenient way of reading these values in the dedicated Peripherals tab in the debug tool window:
Peripheral View

It works for the Embedded GDB Server and OpenOCD Download & Run configurations, and is available when one or more .svd files are loaded. Besides this, it’s useful to know that you can search through the Peripherals (just start typing the name you are looking for), and export the view as a CSV file and/or open it in the editor for future investigation. Learn more about it in this blog post.

Debugger

In the debugger, we’ve bundled GDB 8.3 and introduced a whole new set of GDB-related fixes to improve your experience with it. For example, we’ve fixed the issue with GDB, where the variable’s value was not updated on stepping after “Set value” command, and the issue where GDB hung in the case of MinGW-w64 and multi-line commands is fixed too.

Completion for GDB/LLDB commands

Next, for both LLDB and GDB, we’ve enabled the debugger commands completion in the debugger console tab (by Tab or Ctrl+Space). If you need to use the command line interface for GDB/LLDB, you can now easily do so in CLion:
Debugger completion

On-the-fly detection of pending, resolved, and invalid line breakpoints

Besides, in v2019.2 you’ll notice that CLion can now distinguish between the 3 types of line breakpoints and update their icons on the fly:

  • Pending: Line breakpoint is out of the debugging session, which means the session hasn’t started yet or the corresponding shared library hasn’t yet been loaded.
  • 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. This might happen when the breakpoint is actually located out of the executable code or some debugging symbols are missing.

Line breakpoint types

Experimental debugger features

And finally, there are two experimental features worth mentioning here. First of all, we’d like to remind you that to enable experimental features you need to call up the Maintenance dialog (Shift+Ctrl+Alt+/ on Linux/Windows, ⌥⇧⌘/ on macOS) | Experimental features and turn on the feature you want to use. However, be aware, experimental features are not yet release quality and we provide them mainly for collecting feedback.

cidr.debugger.value.numberFormatting.hex enables the experimental hexadecimal number formatting in the debugger. It was actually added before v2019.2 via the Registry settings, but now it is available under experimental features.

cidr.debugger.lldb.windows enables an experimental debugger for the Microsoft Visual C++ toolchain on Windows!
Windows toolchains

It’s worth saying a few words about the technology it’s based on. For code compiled with the Microsoft Visual C++ compiler, there are several debugging engines available in various tools. In Microsoft tools, there is a vsdebugeng.dll engine used, which is not available to others due to the licensing limitations. CDB and WinGDB use the dbgeng.dll debugging engine. Initially, we attempted to build a debugger on top of it. However, we faced several issues, including crashes and bad performance on large binaries with lots of PDBs. That’s why we’ve explored another option – implementing a debugger on top of LLDB. And it worked! There’s still a lot of work ahead of us, but we are quite optimistic about our chances.

Our LLDB-based debugger can work with the native visualizers taken from the Visual Studio installation or from your project. Just enable it in Settings | Build, Execution, Deployment | Debugger Data Views | Enable NatVis renderers for LLDB:
Debug with LLDb for MSVC

Before you start with this experimental debugger, we recommend you check out the list of known issues and limitations in our blog post.

Go to address and ASCII view in Memory View

Memory View helps you to view the raw memory of the running process when debugging. In v2019.2, it has had several updates added to it. First, the new Go to address means you can navigate to a particular address in the memory from the Memory View. Provide an address (in hex), a variable name, or call its address via & and jump to the corresponding address:
Memory View
Note the code completion working for the known symbol. And also, the ASCII view added on the right of the raw memory view.

More code assistance in the editor

Unused Includes

The ‘Unused Includes’ check was turned off for a while because of the multiple false-positives it ran into. Now, we’ve completely reimplemented the check on top of Clang, and brought it back as default. So if you keep the default Clangd-based engine on, the updated check will work and highlight the include directives which are not necessary.
The check uses the detection strategy configured in the settings, by default, it’s Detect not directly used, which follows the Include What You Use principle – where source files should include exactly the headers that contain the symbols used in that source file. So if declarations from the header are not used in this file directly, CLion will mark the include as unused:
Unused Includes
Other strategies can be configured in Settings / Preferences | Editor | Inspections | C/C++ | Unused code | Unused include directive. Learn more about the implementation here.

Clang-Tidy

The Clang-Tidy binary was updated to a newer Clang version. And the update brings a whole new set of checks, like modernize-avoid-c-arrays, modernize-use-nodiscard, new abseil-* checks, checks from the clang-analyzer-* group, and more. By default, not all of them are on. Please check CLion’s default configuration here.

Parameter Name Hints

How many times were you looking at a function call with parameters like ‘true, false, true’ or ‘10, 20, 30’ and trying to guess which means what? Of course, you can navigate to the function declaration, check the Quick Documentation popup, or call the Parameter Info, but how can you get this information even quicker? Parameter name hints, that’s how!

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.
parameter_info
Learn how to configure the parameter hints.

Code assistance in ClangFormat config files

After introducing ClangFormat in CLion as an alternative formatter in v2019.1, we’ve noticed that users tend to update the .clang-format config files in their projects in CLion. That’s why we’ve added some code assistance for them for this.

CLion completes the name of the options and their values, showing the option’s description in the completion popup. While Quick Documentation (Ctrl+Q on Windows/Linux, F1 on macOS) provides the original documentation with samples.
ClangFormat assistance
This all is implemented by adding a built-in JSON schema, which CLion uses to validate the option’s values against. And if the value doesn’t match, a corresponding warning is shown and a quick-fix is provided.

Performance improvements

Performance has been a top priority for us for several releases in the row already. And we can assure you that there are some great new ideas coming about, which we are carefully investigating and putting into development. However, this is not a matter of one or two release cycles. Often the changes require more work and can even affect the way CLion interacts with the IntelliJ-platform. Meanwhile, smaller steps are making their way into every release. And here are some of the improvements 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 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.

Besides all these incremental changes we are making, in June our team (along with the IntelliJ-platform team) ran an internal performance week / hackathon, playing with several fresh and brave ideas to improve the performance. Some of them worked better than others and we hope to bring them to production in v2019.3.

Syntax highlighting for new languages

Often there is code from other programming languages in your C or C++ project. Python, JavaScript, HTML, XML, and SQL are all bundled into CLion. And there is a handy plugin for Rust. But what about the others which are not as popular in the C++ world, but are still in use? For example, Ruby and C#. For such cases, in v2019.2 we’ve added syntax highlighting for over 20 different programming languages, and it works out of the box – without any additional configuration. The full list of available languages can be found in Settings/Preferences | Editor | TextMate Bundles. And you can add a new language there easily (the support is based on TextMate grammars)!
Ruby in CLion
Note however, that this is only about syntax highlighting. We provide more sophisticated support only for a limited selection of languages in CLion.

Shell Script

When talking about complementary languages in C and C++ projects, shell scripts are natural to the majority of such projects. It is not unusual to do some code generation or build/install steps in such scripts. Coding assistance in shell scripts might be able to help you increase your productivity. That’s why now CLion bundles the Shell Script plugin, which provides some handy features like code highlighting, word and path completion, and even textual Rename:
Shell Script
Writing a script has never been so easy! And you can check scripts right away in the IDE, by running them in the built-in Terminal!

Naming convention

Naming convention is also a feature that appeared in v2019.1, and was later enhanced in v2019.2. We’d like to thank everyone who provided us with feedback and ideas on how to improve the naming convention support in CLion!

With the reworked UI, new settings like Visibility (Public, Private, or Protected) and Specifier (Const or Static), new styles like Leading_snake_case and Upper_Snake_Case the naming convention settings have become much more flexible and powerful. We hope the new UI makes configuration easier for you.
Naming settings
We’ve also put effort into making sure your current naming settings will be migrated smoothly from 2019.1 to 2019.2!

Platform enhancements

CLion is based on the IntelliJ-platform which means that every release brings dozens of platform improvements. For this release the main highlights are as follows:

  • A new plugin page was introduced and make the work with plugins in the IDE much more comfortable. For example, you can now easily enable/disable the installed plugins or read the description of the plugin before installation (as the plugin description is now located right next to the list of plugins).
  • The inspection tooltip has an updated UI – in addition to the problem description, it provides you with the first available fix when possible (to apply it, use Alt+Shift+Enter).
  • As usual, our VCS team prepared a set of updates to the VCS subsystem.
  • The bundled customized JBR was updated to v11 (the fork of OpenJDK 11 with fixes from the JetBrains team). This transition addresses various issues, including performance.

Rust plugin

The Rust plugin was updated significantly in this release. The biggest change is a new experimental macro expansion engine (turn it on in Settings/Preferences | Languages & Frameworks | Rust | Expand declarative macros), which enables such features as highlighting, name resolution, and completion for generated modules and methods from impl blocks. Besides this, it enables navigation in the macro calls.
Rust

Among other notable changes we should mention:

  • New Duplicate code fragments inspection for Rust
  • New Make public and Create Field quick-fixes
  • New Add format string argument and Use destructuring declaration intentions
  • Completion in Evaluate Expression and in GDB/LLDB consoles

That’s it! Of course, there are dozens of various other bug-fixes and improvements, which were not mentioned here, but it’s better to try the new build out on your own and see if it makes a change in your case.

DOWNLOAD CLION 2019.2

Your CLion Team,
JetBrains
The Drive to Develop

What’s Next? CLion 2019.3 Roadmap

$
0
0

CLion 2019.2 landed just a few days ago. Do check it out if you haven’t yet! It’s got a lot of cool things for Embedded developers, an experimental debugger for the MSVC toolchain, a more flexible and reliable Unused Includes check, parameter code hints, and much more. Here is a fantastic video from Phil Nash to quickly take you through the key highlights.

Meanwhile, we are moving forward and thinking through our future updates and the next release. But before we share our plans, let’s take a minute to give our sincerest thanks to the most active evaluators, who helped us make v2019.2 more stable and accurate.

Special thanks

We want to thank all the users – more than 4 thousand in total! – who participated in the 2019.2 Early Access Program. You helped us immensely with the huge variety of possible setups and configurations, and even a few general issues we somehow missed. We greatly appreciate your help!

Continuing our ongoing tradition, we present our most active EAP evaluators with a full 1-year subscription to CLion, which can be redeemed as a new subscription or an extension of a current one. So, here are the contributors that we want to give special thanks:

  • Dmytro Nezhevenko
  • Ivan Stepanov
  • Patrick Turley

You will receive a personal email with details on how to claim your license. (If for some reason you do not get an email from us within a week, ping us here in the comments!)

CLion 2019.3 roadmap

We take application performance and code quality very seriously. Following the internal performance week / hackathon that our team held together with the IntelliJ Platform team this June, we are now planning a special Quality-targeted Release. Here’s what that means in simple words:

  1. We’ll work to flesh out and implement the fresh ideas and fixes we tried during our performance hackathon.
  2. We plan to work intensively on various performance boosts, including some massive overhauls we started earlier this year. You can expect a series of blog posts covering the progress and explaining the underlying ideas, with some measurements on referenced projects so that you can compare them with your cases.
  3. We plan to focus on fixing issues and eliminating pain-points in different areas, rather than introducing new functionality. (Don’t forget to upvote the pain-points that affect you the most, so that we can prioritize them to help as many users as possible!)
  4. We still plan to continue our work in the directions we feel are important, such as covering Makefiles support and some others. Please read on for the details.

The following is a detailed plan for the next release cycle.

Note: This is a preliminary plan, which means we cannot guarantee that all of the features listed below will be included in CLion 2019.3.
  • C++ language support
    • Mostly bug-fixing and performance improvements as mentioned above.
    • Rework an action to switch header/source (CPP-12920).
    • Deeper integration with the Clangd-based engine, especially in the areas where it helps eliminate performance issues and lags (for example, Clangd-based code completion).
    • Investigation and fixes for various crashes and memory leaks in Clangd-based engine.
  • Project model
  • Remote development
    • Investigate WSL v2 support opportunities (CPP-16543).
    • Remote debugging with gdbserver via ssh (CPP-7050).
    • Performance improvements for remote mode.
  • Debugger
    • Improve the quality of the experimental debugger for Microsoft Visual C++ toolchain (you can expect some NatVis related fixes in 2019.2.x updates already).
    • Support for .gdbinit/.lldbinit located in project folders.
    • Input/output redirection (CPP-3153).
    • Performance investigations and improvements.
  • Embedded Development
    • Mostly bug-fixing (which means your feedback on the recently added functionality will be very important!).
    • Console for GDBServer (CPP-15392, CPP-7103).
  • Code coverage

Do you have any new feature requests? Please send them to our tracker. We’re listening!

Your CLion Team

JetBrains
The Drive to Develop

CLion 2019.2.1 Bug-fix Update

$
0
0

Hi,

CLion 2019.2 was released just a few weeks ago, and now we are ready to give you the first bug-fix update. CLion 2019.2.1 (build 192.6262.62) is now available for download from our website, via the Toolbox App, or via snap (for Ubuntu). A patch update will be available shortly. If you haven’t updated to v2019.2 yet, now’s a good time to do so.

DOWNLOAD CLION

This update brings important fixes in several areas.

Fixes in the experimental debugger for MSVC

CLion v2019.2 introduced an experimental debugger for the Microsoft Visual C++ toolchain. Being experimental, it was launched with a list of known issues and limitations. In this update, we’ve fixed some of them:

  • Fixes for the callstacks:
    • Full support for call stacks on x64 systems, including information from exception handling tables.
    • Fixed function representation in call stack.
  • Fixes for stepping:
    • Support for Force Step into, which gets you into the Disassembly View (if the source code is not available).
    • Step over call from within the recursive function now works.
    • Stepping through exceptions now works (Step over call from within try with a throw block now goes to the corresponding catch block).
    • Performance improvements for stepping when variables are muted.
  • Fixes for threads:
    • Threads’ names in the list of threads are now available.
    • Threads are sorted by created time.
  • Fixes in rendering:
    • Fixed issues with rendering STL types (all containers from CPP-16661 now work).
    • Custom NatVis in STL container is now working (CPP-16675).
    • Custom NatVis loaded from the outside of the project directory is now working (CPP-16676).
  • Other fixes:
    • Watchpoints are now working (CPP-14936).
    • Exception breakpoints are now working (CPP-14564).

Other C++-related improvements

Unfortunately, in v2019.2 several inspection settings were not imported correctly when upgrading from 2019.1. This is now fixed.

We’ve also fixed a freeze on Go to Declaration (CPP-13969).

JBR update

With this bug-fix update, we have also updated both JetBrains Runtime 11 and JetBrains Runtime 8, on which CLion and other IntelliJ-based IDEs are built. The fixes covered the broken rendering of Fira Code fonts, IDE-managed HiDPI mode on Windows, the issue with the Ctrl+C shortcut in the integrated terminal on macOS, and a crash when WebView is used on RHEL Linux 7.3. For more details, see this blog post.

Find the full release notes here. Want to know what’s next? See our roadmap for CLion 2019.3.

DOWNLOAD CLION

Your CLion Team
JetBrains
The Drive to Develop


CLion 2019.2.2 Bug-fix Update

$
0
0

Hi,

A new bug-fix update, CLion 2019.2.2 (build 192.6603.37), is now available for download from our website, via the Toolbox App, or via snap (for Ubuntu). A patch update will be available shortly. If you haven’t updated to v2019.2 yet, now’s a good time to do so.

DOWNLOAD CLION

Fixes for parameter name hints

CLion 2019.2 introduced a new feature called Parameter Hints. These are the names of function parameters for passed arguments, which are displayed in the editor in line with your code to help increase its readability.

In this bug-fix update, we’ve fixed a few issues related to Parameter Hints in CLion:

  • There is a default black-list now for C++ Parameter Hints. It includes std::min/max, std::forward, std::vector::push_back, strcmp / strncmp, and some others:

Hint blacklist

  • Parameter hints now correctly handle brace elision in aggregate initialization:

Brace ellision

  • In pack expansion, the & hint is now shown for all the parameters.
  • Now, CLion doesn’t show a hint if there’s a comment matching the hint / parameter name. It recognizes comments in the form of /*NAME=*/ (the = can be any character and NAME must match the hint for that argument).
  • A Parameter Hint is now shown before NULL.

Bundled LLDB on Catalina macOS

macOS 10.15 Catalina is gonna be released soon, so we’ve made sure the bundled LLDB works there (CPP-17126). There are still some possible warnings (CPP-17268), but they don’t seem to prevent debugging.

JetBrains Runtime update

Finally, JBR 11 has been updated and addresses the following issues:

  • Fixed the corrupted fonts on the Welcome Screen on Windows (JBR-1777).
  • Fixed the issue that caused incorrect font (italics) in the editor (JBR-1778).

The full list of JBR improvements can be found here.

IDE release notes are also available.

Your CLion Team
JetBrains
The Drive to Develop

CLion Starts 2019.3 EAP: Performance Improvements, Clangd-based Code Completion & Remote Debug via gdbserver

$
0
0

Hi,

Today we are launching the Early Access Program (EAP) for CLion 2019.3. We plan to release it by the end of this fall and, as you may remember, it was announced to be a special Quality-targeted Release.

As usual, the EAP builds are free to use and no license is required. The main goal is to test them in all kinds of non-standard or unusual environments you may have set up, and collect and fix as many issues and regressions as possible. So go ahead and grab a fresh build to try it now!

DOWNLOAD CLION 2019.3 EAP

Build 193.3519.24 is available from our site, via the Toolbox App, or as a snap package (if you are using Ubuntu).

CLion 2019.3 EAP

Key highlights:

Clangd-based code completion

To eliminate performance issues and lags, we continue integrating with the Clangd-based engine in the areas where it provides an advantage. This time it’s code completion.

CLion has several providers for code completion, which now include Clangd. The results are shown to you as soon as they arrive, so usually the first results come from the fastest provider. Clangd however produces the results in batches by 100 options. So in the performance metrics shown below, we’ve measured the time (in ms) to get the first 100 results (or fewer, if there are less than 100 results in total). The measurements were taken on a Core i7-8750H PC with 32 GB of RAM running 64-bit Windows 10.

On regular middle-sized projects, the results turned out to be quite similar for Clangd and CLion. However, on projects with known performance issues and lags due to CLion’s code completion, the results are very encouraging.

First comes LLVM (natural choice as we tend to dogfood CLion for Clangd development in the team!):
Code completion: LLVM
For the Eigen library, the acceleration is even more exciting!
Code completion: Eigen

A similar (or even better!) boost can be observed for Boost. For example, for boost::multi_index, nearly any completion for the multi_index_container is way faster (125 ms on Clangd vs 25,000 ms on CLion’s own engine).

For the Qt library, we observed a reasonable boost as well:
Code completion: Qt
You may ask, “Why do you keep the existing CLion code completion engine at all?” The main reason is that it offers additional results that are not yet possible to achieve with Clangd-based code completion. These include, for example, showing not-yet-included symbols, providing some reasonable hints for dependent code in templates, and so on.

So now, it’s up to you to check Clangd-based code completion on your project and see what kinds of speedups you get. Let us know how it goes!

Optimizing Building/Updating symbols step and fixing UI freezes

As we’ve already shared with you, in June our team ran an internal performance week / hackathon (along with the IntelliJ Platform team), playing with several fresh and brave ideas to improve the IDE’s performance. We focused mainly on optimizing the Building/Updating symbols step. The successful experiments have made their way into this 2019.3 EAP build.

Depending on the project and system characteristics, the boost is 10% to 50%, according to our measurements. This is covered by such tickets as CPP-16552, CPP-16991, CPP-16992, and some others. Note that these results are heavily dependent on the specific project, CPU, and environment you’re using, so please let us know whether you notice any improvements in your setup.

In addition, several UI freezes have been fixed:

We will continue coming up with various performance improvements and eliminating freezes, so stay tuned!

Search only for code usages when doing a Rename refactoring

Previously, when you called up the Rename refactoring for a variable, CLion first searched for all usages of the variable, including non-code usages such as string literals and comments. Then it suggested choosing between "Rename All Usages" and "Rename Only Code Usages". This could be very time-consuming and not even needed, if you really just wanted to rename only code usages.

Starting now, the Rename refactoring can ask you to make this decision before the actual search. To switch to such behavior, go to Settings/Preferences | Editor | General | Refactorings and turn off the setting ‘Enable in-place mode’ (it’s on by default). Then, when you press Shift+F6 / ⇧F6, CLion will first suggest the Rename dialog. Clear the checkboxes in this dialog (“Search in comments and strings” and “Search for text occurrences”) so that CLion searches for code usages only:
rename dialog

Launching remote targets automatically under gdbserver

Until now, if you did not use the Full Remote Mode in CLion, but built locally and just wanted to debug an executable running on a remote machine under gdbserver, you had to launch your program under gdbserver manually. Now, the hassle is gone – CLion will do the job for you!

To get it working, create a Remote GDB Server configuration instead of using the GDB Remote Debug configuration. Fill in the credentials of your remote machine and wait for the connection to be established:
Remote GDB debug

Now, if you select this Run/Debug configuration, you can debug on a remote machine via the remote gdbserver.

Other changes

Among other changes you will find:

  • Microsoft’s predefined formatting and naming style was added to the list of predefined styles in CLion:

MS style

  • To prevent situations when virtual functions accesses the resources that are not yet initialized or have already been destroyed, CLion gets a new inspection that detects virtual functions called from constructors or destructors. (Note! The inspection works only when Clangd is enabled.)
  • CMake 3.15 is now bundled.
  • Spell Checker now works in CMake and Doxygen comments.
  • CLion now bundles the Markdown plugin. Note, that if you have a Markdown Navigator plugin installed, this might cause a known issue. As a workaround, remove the Markdown Navigator from the plugin directory and restart CLion.
  • There are lots of improvements coming from the IntelliJ Platform, like smooth mouse scrolling, a timeline for GitHub pull requests, reworked Clone dialog, and many fixes to the JetBrains Runtime. Read about these changes in the IntelliJ IDEA blog.

That’s it for now! Give this build a try and stay tuned for further fixes and improvements!

DOWNLOAD CLION 2019.3 EAP

Your CLion Team

JetBrains
The Drive to Develop

CLion 2019.3 EAP and 2019.2.3 Bug-fix Update

$
0
0

Hi,

Today we have a few updates for you. If you’re using a stable release version, there’s a new bug-fix update to v2019.2. And if you’re helping us nit-pick the 2019.3 EAP builds, we’ve got a new build for you.

CLion 2019.3 EAP 2

The Early Access Program for CLion 2019.3 started recently with lots of performance fixes, Clangd-based code completion, updates to remote debugging via gdbserver, and more. Now it’s time for the second 2019.3 EAP build!

Build 193.3793.19 is available from our site, via the Toolbox App, or as a snap package (if you are using Ubuntu). A patch-update for those using the first EAP build will be available shortly.

DOWNLOAD CLION 2019.3 EAP

Python

First of all, Python support is back:
python_back
We sincerely apologize for this delay. We know you were eager to try the first 2019.3 EAP but had to wait because of this issue. Thanks for your patience!

Loading project w/o -fpch-preprocess flag

We’ve got a few reports from users whose compilers don’t support the -fpch-preprocess flag, which CLion uses while reloading the project.

CLion relies on this flag to handle projects that use PCHs. It helps the IDE understand the sources used to create the precompiled binaries, as well as correctly handle any invalid arguments passed to -include. However, this causes issues for some old or embedded compilers that don’t support the flag.

Now, if a compiler doesn’t support the -fpch-preprocess flag and generates an appropriate message about this, the "Reloading Project" process will complete successfully (with a warning status). If you would like to completely disable -fpch-preprocess, please go to Help | Find Action, type Registry and disable the registry option cidr.compiler.gcc.fpch.preprocess.

Other highlights

  • Fixes in code analysis and highlighting:
    • Checks for endless loops are now disabled for functions marked with __attribute__((noreturn)).
    • Fixed a regression with Clangd incorrectly highlighting opening and closing brackets differently (CPP-15273).
  • We’ve added a new option to make the scrollbars more visible. To enable it, go to Preferences/Settings | Appearance & Behavior | Appearance and select the ‘Use contrast scrollbars’ checkbox. Also note that starting with v2019.2, macOS users can configure the editor scrollbar color and opacity at Preferences | Editor | Color Scheme | General | Editor | Vertical Scrollbar:
    scroll_bar_colors

Find the release notes here.

CLion 2019.2.3

A new bug-fix update, v2019.2.3 (build 192.6817.18), is available for download, along with a patch update.

DOWNLOAD CLION 2019.2.3

This update bundles CMake v3.15.3 and provides a set of platform and UI/UX improvements, such as the “Use contrast scrollbars” setting introduced in 2019.3 EAP and ported to 2019.2.3. Besides, the IDE now supports native password storage on Linux (IDEA-185926).

For more details, please see the full release notes for the IDE and for the JetBrains Runtime.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.3 EAP: Support for WSL 2 and LLDB 9

$
0
0

Hi,

A new CLion 2019.3 EAP (build 193.4099.17) 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 those using the first EAP build will be available shortly.

DOWNLOAD CLION 2019.3 EAP

WSL 2

WSL (Windows Subsystem for Linux) is a compatibility layer for running Linux binary executables natively on Windows 10. CLion supports developing in a WSL environment, which is when you have your IDE launched on a Windows machine, but you target WSL/Linux in your development. This includes providing code assistance using the linked libraries from the WSL and, of course, building, running, debugging, and testing inside the WSL.

Not so long ago Microsoft introduced WSL v2. In a nutshell, its main difference from WSL v1 is that it has a lightweight virtual machine working inside with a Linux core on top. From the user’s perspective, things largely remain unchanged – check out the official Microsoft doc for more details. By the way, you can keep both WSL versions in parallel on your Windows machine.

From the perspective of CLion’s implementation, we had to support the new file system interaction protocol (interestingly, increasing the file system performance was the primary goal for WSL 2) and some networking configuration settings. Now, WSL 2 is enabled in CLion 2019.3 EAP. The great thing is that CLion’s configuration process is completely the same for WSL 1 and WSL 2!

A short configuration guide for you to start:

  1. WSL 2 installation instructions.
  2. See the official notes about placing files that your Linux apps will access in your Linux root file system, accessing network applications using an IP address, and not using localhost.
  3. Follow the CLion’s configuration instructions for WSL.

You are all set up now!
wsl

LLDB 9

The recent release of LLDB 9 is now bundled on macOS and Linux for debugging in CLion.

Faster startup

A few architectural changes in the IntelliJ Platform allowed to reduce startup times in all IDEs based on the platform. And CLion is no exception here! Check the details in this blog post.

The full release notes are available by the link.

Your CLion Team
JetBrains
The Drive to Develop

Debugging Rust Code in CLion

$
0
0

It’s been a while since we last dedicated a whole blog entry to IntelliJ Rust. In this post, we’ll take a closer look at how the plugin cooperates with CLion when it comes to debugging your Rust applications.

We’ll start by diving right into a debug session to get a grounding in the basics, and then we’ll explore the debugger settings and additional options in detail.


If you need more information at any point, please refer to the plugin’s Quick Start Guide and the Debug section in CLion’s web help.

Before you begin

First of all, make sure that your project is fully loaded. If the indexing is finished and the Cargo tool window shows all the modules and targets of the workspace, you’re good to go.

On Windows, go to Settings | Build, Execution, Deployment | Toolchain and set either Cygwin or MinGW as your working environment. Then, run rustup toolchain list and check the first line: it should be one of the gnu versions matching the bitness of the debugger. For example, if you’re working on MinGW (32-bit), the default toolchain should be i686-pc-windows-gnu. If you’re on MinGW64, it should be x86_64-pc-windows-gnu. You can set the appropriate toolchain by running rustup default <toolchain_name>.

How to start debugging

If we want to debug a test or target that doesn’t take input arguments, the quickest way is to use the gutter menu.

Let’s pick a test we want to debug, place a few breakpoints in the code, and click the gutter icon next to the test name:

Gutter menu with run and debug options

The plugin will call cargo test to get the non-optimized binary with debug information, which it will then launch under the debugger.

When our test hits the first breakpoint, the Debug window pops up automatically. It’s organized around the stack trace and threads: we can switch from one thread to another and travel up and down the frames.

On the right side, we have the variables in the current scope. We can search in this pane by typing right into it and expand the child nodes of the data structures.

Variables pane of the Debug tool window

Actually, we don’t have to dig into the Variables pane at every step, as the values are also shown inline, together with the variables:

Inline variables view

Across the top of the Debug window, we have stepping buttons like Step Over (F8), Step Into (F7), and Force Step Into (Shift+Alt+F7 on Windows/Linux, ⇧⌥F7 on macOS). The latter is helpful when we want to get into a function whose source code is unavailable. In such cases, Force Step Into jumps right to disassembly:

Stepping actions and disassembly view

Now that we know how to step through and examine variables, let’s stop the session and take a look at the settings.

Switching debuggers and renderers

We can pick the debugger that IntelliJ Rust will employ:

  • On macOS and Linux, the options are bundled LLDB, bundled GDB, or a custom GDB binary.
  • On Windows, we can choose between bundled GDB for MinGW, Cygwin GDB, or custom GDB.

The supported versions are listed in CLion’s web help.

Selecting debugger in the toolchain settings

Apart from the debugger itself, we can switch the renderers it will use when showing Rust types in the Variables pane:

Selecting debugger renderers

No renderers: This option disables explicit rendering, leaving only the type support provided by GDB or LLDB natively. Because Rust type formatters are not available in the debuggers out of the box in their current state, this option means no rendering for types that differ from C/C++.

Rust compiler’s renderers: With this option, IntelliJ Rust takes pretty-printers from the standard rustc distribution and loads them onto the debugger.

Example of vectors visualized by the compiler renderers

Bundled renderers: The plugin’s own renderers were implemented from scratch for both GDB and LLDB, unifying types representation for the two debuggers. These formatters build tree views for strings, structs, enums, and vectors, making it easier for you to look inside child elements.

Example of vectors visualized by the bundled renderers

The bundled renderers also support standard library types like HashMap, HashSet, Rc, Arc, Cell, Ref, and others.

Example of HashMap and Arc visualized by the bundled renderers

Debugging a Cargo Command configuration

Let’s get back to debugging, but this time let’s use a run/debug configuration.

In fact, when earlier we started a debug session from the gutter menu, CLion created a temporary Cargo Command configuration, which we can see greyed out in the switcher:

Configuration switcher

Temporary configurations are fully functional, but you can only have a limited number of them at a time. So if you debug many targets and tests using gutter menus, only the last few corresponding configurations will be available. You can always use Save… to make them permanent though.

To create another configuration based on the same template, go to Edit Configurations, click +, and then select Cargo Command.

Cargo Command run/debug configuration

Use the following pattern for the Command field:
[run] or [test] [build options] [--] [program arguments]

Notice the -- prefix followed by an extra space. It separates the input arguments from the build options that will be passed to Cargo.

When we debug this configuration, the plugin will start by calling cargo build [build options] and then it will launch the binary under the debugger with [program arguments].

Now we can save this configuration. Make sure to select it in the switcher, and click Debug (Ctrl+D on Windows/Linux, ⌃D on macOS) to start a new session.

More debug features

Evaluate Expression (Alt+F8 on Windows/Linux, ⌥F8 on macOS) helps us calculate values on the run and monitor how the results are changing while we step.

Keep in mind though that the evaluation is performed by GDB or LLDB, which means the functionality is limited to what the particular debugger’s parser can provide (for GDB, check out the supported Rust features). Because of this, Evaluate Expression currently works only in simple cases like arithmetic and logic operations with possible access to structure elements and pointers. The same limitations apply to the expressions you can set for conditional breakpoints.

Evaluate expression

If we pick a pointer in the Variables pane and call Show in Memory View from the context menu, we will get into the raw memory of the running process. This action opens a window with a 256-byte memory region starting from the chosen address.

While we are stepping through the code, the Memory View highlights the changes happening in the current range:

Memory view

If we want to access the GDB/LLDB console, there is no need to leave CLion: the debugger console is located next to the Variables tab. It shows the debugger’s output and lets us run commands with the completion assistance that GDB and LLDB provide for their command sets.

Debugger console

Another tiny but handy feature is the Hex View. It calculates hexadecimal values for integer variables and shows them alongside the original formatting (or instead of it).

When enabled, hex values are shown both in the Variables pane and inlined in the editor:

Hexadecimal formatting

The Hex View is under development at the moment. If you want to turn it on, follow these instructions from the web help.

One more feature that can help us debug is a configuration setting called Backtrace. It lets you set the RUST_BACKTRACE environment variable, which prints the unwound stack trace into error messages and controls its length.

Although debuggers don’t suspend Rust programs on fatal errors (panic!-s), Backtrace gives us the opportunity to investigate what happened by digging into the printed trace. Here is an example of how it looks when Backtrace is set to Full:

Backtrace log
________________________

That’s about it for debugging Rust code today. Thanks for reading!

If you have any questions, feel free to ask them here in the comments or ping the IntelliJ Rust team in gitter.

We plan to publish a series of blog posts covering Rust development in CLion. Keep an eye on the blog, or subscribe by selecting the Send me Rust blog posts checkbox (scroll up and look on the right-hand side of the blog page).

Ready to give the debugging features a try? Click the button below to get CLion and then install the Rust plugin.

DOWNLOAD CLION 2019.2

Your Rust Team
JetBrains
The Drive to Develop

CLion 2019.2.4 Bug-fix Update

$
0
0

Hi,

If you are using macOS 10.15 Catalina and the recent CLion release 2019.2.3 (or any CLion version earlier than 2019.2.2), please update to get the LLDB working.

DOWNLOAD CLION

macOS Catalina was finally released a few days ago. We started testing and fixing some issues there well in advance, and CLion 2019.2.2 was released a month ago with a fix for LLDB on Catalina.

Unfortunately, in CLion 2019.2.3 the debugger on Catalina was broken. After the official macOS release, our users have faced an issue when launching the debugger (CPP-17613). We are really sorry about this, and we’re now releasing a new bug-fix update 2019.2.4 with the proper fix included.

We’ve also investigated the issue internally to prevent similar problems in the future.

CLion 2019.3 EAP is not affected and has LLDB working on Catalina.

Please note that some possible warnings (CPP-17268) are still present but don’t seem to prevent debugging. Also, another update CLion 2019.2.5 with more fixes from the IntelliJ Platform, which in particular targets macOS 10.15 Catalina users, will be released in a few weeks. Stay tuned!

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.3 EAP: Debugger Improvements

$
0
0

Hi,

A new CLion 2019.3 EAP (build 193.4386.19) 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 those using the previous EAP build will be available shortly.

DOWNLOAD CLION 2019.3 EAP

In this quality-targeted release, we work a lot on polishing CLion’s support for debuggers. As you know, we support two back-ends, LLDB and GDB. This build brings some long-awaited improvements and fixes for both.

LLDB: better pretty printers are in use

In the previous EAP build, we updated the bundled LLDB on macOS and Linux to v9.0. Now, we’ve cleaned the incorrectly working pretty printers for LLDB, fixing a whole set of related issues, which you can find linked to the parent ticket CPP-17548.

From the tables below, you can see that on macOS, libc++ is handled much better than libstdcxx for now:
macos_printers

On Ubuntu, there is more of a parity between the two:
ubuntu_printers

GDB: read .gdbinit from the project root

Quite often you need to tune the debugger behavior via passing some commands and options in a .gdbinit file. Previously, CLion always read this file from the user’s home directory, which definitely was not very convenient and could cause conflicts. Now, CLion supports reading the .gdbinit file from the project root directory. This means you can customize your GDB experience on a per-project basis.

Note that to enable this behavior, you have to explicitly allow it in your home .gdbinit file, either globally or for a particular project. For the exact commands, see this.

By the way, a similar feature for LLDB is currently in development as well. Stay tuned!

Improvements from the IntelliJ Platform

There are also more enhancements in CLion coming from the IntelliJ Platform:

  • We’ve updated the Database support bundled into CLion with initial support for MongoDB.
  • We’ve fixed the issue with project opening on macOS 10.15 Catalina (JBR-1721).

Read more details in this blog post.

The full release notes are available here.

Your CLion Team
JetBrains
The Drive to Develop


CLion 2019.3 EAP: Ninja or Another Generator of Your Choice in CMake

$
0
0

Hi,

A new CLion 2019.3 EAP (build 193.4697.8) 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

CMake remains the most deeply integrated project model in CLion. However, from the very beginning, we supported only the Makefiles generator. This limitation was caused by the fact that CLion was parsing the output of CMake command run with parameters such as -G “CodeBlocks – Unix Makefiles”, -G "CodeBlocks – MinGW Makefiles", or -G "CodeBlocks – NMake Makefiles" to get information about the project, which made it impossible to change the generator used.

This obviously caused some problems:

  • Ninja is known to be a much faster generator and is one of the most requested alternatives (CPP-2659).
  • With the Visual Studio toolchain, CLion was using something very similar to Makefiles – NMake, but the community expected Visual Studio CMake generators (CPP-14730).

As a solution, we considered supporting the CMake server first, but later found a better alternative – the new CMake File API, which was added by the CMake authors as a new and better way to query project information. And now, we are happy to present to you the new CLion 2019.3 build with this new API supported!

In practice, this gives you an opportunity to use any CMake generator of your choice!

Let’s look at the details.

How can I change the generator?

A very simple action is required to change the generator – just go to the CMake Profile settings in Settings / Preferences | Build, Execution, Deployment | CMake and pass the generator name in the CMake options, for example, -G Ninja:
cmake_generator

After successfully reloading your project, you can see some similar output via the generation path:
ninja_output

This works for all platforms, remote mode, and the WSL, and for all generators supported by CMake (Ninja, Xcode, Visual Studio, and Makefiles). And you can use different generators in different CMake Profiles if necessary.

There are, however, a few things to bear in mind:

  • While CMake File API first appeared in CMake 3.14, CLion supports the feature only with CMake 3.15 or higher. (Currently, CMake 3.15.3 is bundled into the 2019.3 EAP builds, so you don’t have to install anything additionally, if you simply rely on a bundled version.)
  • Make sure you have the generator itself installed on your machine (like Ninja, for example).
  • Recompiling individual files is not supported in cases where the generator was changed as CLion can’t restore the build rules information easily (CPP-17622).

How do build type settings work for multi-configuration generators?

Xcode and Visual Studio are so-called multi-configuration generators, which means the project files for all build types will be generated by CMake. However, CLion will only use the build type specified in the CMake Profile settings for indexing and the actual building (in the build command line arguments, you can find the proper config is passed by CLion, for example: –config Debug).

That’s it for today! The full release notes are available here.

DOWNLOAD CLION 2019.3 EAP

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.3 EAP: Fixes for CMake Generators, Disassembly, and More

$
0
0

Hi,

A new CLion 2019.3 EAP (build 193.4778.13) 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

Generators in CMake

In the recent EAP build, we’ve added support for Ninja and other generators in CMake. We’ve had tons of valuable feedback and discovered cases we hadn’t tried on our side! It was great that, with your help, we were able to catch all these problems and we have worked hard over the week to fix the most annoying ones. Today’s build brings a few important fixes:

  • On Windows, an exception was caught that could prevent your project from correctly loading CMake and the project build (CPP-17728, CPP-17740).
  • For any generator which is not Makefiles (default) or Unix/MinGW/MSYS Makefiles, the custom make path in the Toolchains settings is ignored now. This was preventing Ninja from working correctly (CPP-17749). Later, we plan to allow users to specify their custom build tool in this field, for example, any custom Ninja version (CPP-17773).

Experimental debugger for MSVC

Some users noticed that the experimental debugger for the Microsoft Visual C++ toolchain had stopped working in the recent EAP build. Now, it’s fixed and back again. We are sorry for any inconvenience this may have caused!

Other fixes

A few issues with disassembling on Windows were fixed (CPP-15210, CPP-15828, CPP-17115).

Besides, there are some VCS improvements coming from the IntelliJ Platform.

The full release notes are available here.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.3 EAP: Code Coverage, CMake Defaults, and better LLDB integration

$
0
0

Hi,

A new CLion 2019.3 EAP (build 193.4932.12) 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:

Code Coverage

Code coverage in CLion relies on llvm-cov/gcov integration to perform and show you statements coverage measuring for your code. In general, statements coverage answers the question, "Was this statement executed during the configuration run?". The configuration can be either a unit tests run or a regular configuration run.

How to launch a configuration with coverage?

To get coverage measurement, you have to pass special coverage compile options. There are a few options depending on what compiler you use and what kind of results you expect:

  • -fprofile-arcs -ftest-coverage or an equivalent --coverage – for GCC (uses gcov) and Clang (uses llvm-cov gcov, gcov-style coverage, which means it will compatible with the gcov tool from version 4.2 of GCC)
  • -fprofile-instr-generate -fcoverage-mapping – for Clang (uses llvm-profdata merge / llvm-cov export, a clang’s instrumentation based profiling).

For example, if you use both GCC and Clang in your project, you may have something like this in your CMakeLists.txt:
coverage_cmake

Now you can run it using the run icon in the left gutter:
coverage_run

Or you can click the “Run … with Coverage” button coverage_icon in the Navigation Bar.

How to read the results

Coverage measurements are located in the Coverage tool window, which shows results per folder (% of files and % of lines covered) and per file (% of lines covered):
coverage_results

When rerunning the coverage analysis, CLion will ask you how you’d like the results presented:

  • Add to active suites – to enrich the current results.
  • Replace active suites – to start from scratch.
  • Do not apply collected coverage data – to simply ignore the current results.

Another way of exploring the results is to check the color indication in the left gutter in the editor.
coverage_indication_gutter

Click the gutter area to see how many times the line was hit.

Configuration and known issue

Coverage settings, including custom paths to gcov / llvm-cov / llvm-profdata tools and more, can be found in Settings/Preferences | Build, Execution, Deployment | Coverage:
coverage_settings

A few important known issues are worth mentioning:

  • Code coverage doesn’t work with Ninja generator (CPP-17864). We’ll do our best to address this issue before the release.
  • Code Coverage is not supported for the remote toolchain (CPP-17709).
  • Generate Coverage Report – an action you may be familiar with if you use IntelliJ IDEA – is not available yet (CPP-17710).

Other bugs and requests are linked to the parent ticket, CPP-9678. Please try the EAP build with code coverage support and share your feedback with us!

CMake defaults

If you have to work with a lot of new projects in CLion, you may want to simplify the process of configuring CMake Profiles, for example by configuring a common pattern for the CMake generation folder.

Starting with this EAP, you can configure one or several default CMake Profiles which will be used for all your new CLion projects! Use File | Other Settings | Settings/Preferences for New Projects…:
cmake_settings

You can set the default:

  • Generator used in CMake
  • Options passed to CMake
  • Toolchain
  • Build type
  • Environment
  • Generation path
  • Build options

When a new project is started, these default CMake Profiles will be used. Note that currently, this doesn’t apply when File | New CMake Project from Sources is used (CPP-17686).

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 might need it 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. For the exact commands, see this.

That’s it for today! The full release notes are available here.

DOWNLOAD CLION 2019.3 EAP

Your CLion Team
JetBrains
The Drive to Develop

CLion 2019.2.5 Bug-fix Update

$
0
0

Hi,

A minor update CLion 2019.2.5 is out! Build 192.7142.39 is now available for download from our website, via the Toolbox App, or via snap (for Ubuntu). A patch update will be available shortly.

DOWNLOAD CLION

This minor release brings some fixes from the IntelliJ Platform, including several notable changes for macOS Catalina:

  • Fixed opening projects on macOS Catalina (JBR-1721).
  • Fixed font rendering in text fields on macOS Catalina (JBR-1863).

The full list of JBR improvements can be found here. IDE release notes are also available.

Your CLion Team
JetBrains
The Drive to Develop

C++ Annotated: March–October 2019

$
0
0

Hi,

Since our last edition in February came out, the C++ community has organized lots of fantastic conferences, held productive C++ Committee discussions, and published tons of educational posts. We, in the meantime, have been rethinking the format of the C++ Annotated series.

At JetBrains, we do several other monthly digests with briefly annotated links to the latest articles and posts around the respective technologies: .NET Annotated, Java Annotated, and PHP Annotated. In C++, so far we’ve followed a slightly different approach, diving deeper into some particular topics, like detailed overviews of conferences, various tools releases, learning materials, and, lately, C++ proposals you don’t want to miss. This turned each digest into quite a long read.

We’ve been considering other formats to make the C++ Annotated more accessible and easier to navigate. Finally, we’ve decided to cut some sections but keep others detailed, to strike a balance between short link annotations and interesting stories we’ve come across and we feel are valuable for the C++ community.

Now it’s your turn! Read, comment, and share your thoughts on the direction we are taking C++ Annotated. We are listening!

C++ Annotated

Today:

C++ Conferences

We’ll provide only brief annotations for recent conferences, sharing the key outcomes like the playlist and most notable talks. For upcoming conferences, we’ll focus on the announced keynotes and Calls For Papers where open.

Catch these upcoming conferences while you can

Coming soon:

  • ACCU 2019 Autumn Conference will be held in Belfast, Northern Ireland, on Nov 11 & 12, and will follow the WG21 (C++ standard committee) meeting at the same location. This will be a great chance to catch the Committee members – registration is still running!
  • Meeting C++ 2019, a traditional gathering at the Vienna House Andels Hotel in Berlin, Germany, will follow the ACCU event from Nov 14 through Nov 16. Expect great keynotes from Howard Hinnant, Frances Buontempo, and Walter E. Brown. A few tickets are still up for grabs.
  • code::dive 2019 will happen in Wrocław, Poland, on Nov 20 & 21, and will gather C++ experts along joined by IT experts from other areas. If you haven’t registered, it is too late to get in now – the event is full.
  • C++ CoreHard Autumn 2019 will happen in Minsk, Belarus, at the end of November, gathering local and international speakers for one day of workshops and one day of conference. Tickets are currently for sale.

As of today, you can still submit a talk for:

Learn from these events even if you missed them

ACCUHeld this April in Bristol, UK, ACCU 2019 was the central event for the ACCU community, focusing not only on C++ (which is still a strong trend there) but also on programming professionalism in general. Its playlist consists of several talks given on Day 1, Day 2, Day 3, and Day 4, including such brilliant presentations as Herb Sutter’s keynote, De-fragmenting C++: Making Exceptions More Affordable and Usable, Michael Wong’s GPU Programming with Modern C++, Patricia Aas’s The Anatomy of an Exploit, and others.
C++ Russia
C++ Russia 2019 happened in Moscow in April and was a huge success thanks to the Jug.Ru group now helping C++ User Group Russia with the organization, and of course a great lineup of both Russian and international speakers headlining the event.

The playlist from C++ Russia 2019 includes Nicolai Josuttis’s C++17 — the Biggest Traps, Timur Doumler’s Initialization in Modern C++, Rainer Grimm’s Concurrency and Parallelism in C++17 and C++20/23, and Ivan Čukić’s Move-only C++ Design, among others.

C++NowC++Now 2019, a traditional family-like gathering of top C++ experts in beautiful Aspen, Colorado, brought top-quality content as usual and highlighted some new names to keep an eye out for.

The videos are already in the channel, covering talks by Conor Hoekstra (a first-time attendee who dominated the voting for Best Session, Best Speaker, Best New, and Most Educational), David Sankel, Gašper Ažman, Ben Deane, Marshall Clow, Alisdair Meredith, and other top C++ experts.

Core C++Tel-Aviv, Israel hosted Core C++ 2019 for the first time ever, and with great success! Framed by some outstanding workshops from Jason Turner, Dan Saks, the Conan/JFrog team, and others, it brought many famous international speakers and introduced great local speakers to the community.

Check out the playlist from the conference, which includes a great hacking topic by Gal Zaban, Behind Enemy Lines – Reverse Engineering C++ in Modern Ages, as well as Bryce Adelstein’s Modules are Coming, Jason Turner’s The Best Parts of C++, and many others.

CppConCppCon 2019 kicked off the fall round of C++ events at its new home in Gaylord Rockies in Aurora, Colorado. The participants have shared lots of podcasts and trip reports describing their impressions.

The playlist is already in progress; the first videos were added while the conference was still running. Don’t miss Bjarne Stroustrup’s C++20: C++ at 40, Sean Parent’s Better Code: Relationships, Miro Knejp’s absolute must-watch Non-conforming C++: the Secrets the Committee Is Hiding From You, and more worthy talks.

Proposals you don’t want to miss

Continuing our series on noteworthy C++ proposals that either have been accepted into the upcoming standard (C++20, in this case) or are still being discussed for future standards, this time we look at one for C++20 and one that will hopefully make it into C++23. However, even the latter builds on a less-known feature we’ve had since C++11, so it should be relevant to everyone today.

The Spaceship has landed

Spaceship operator
P0515
We’re not the first ones to make that joke and we won’t be the last. However, the three-way comparison operator (a.k.a. The Spaceship Operator) is no joke!

The proposal is actually called "Consistent comparison." But what does that mean, and how will it change everyday code?

Currently (until C++20), if we want our custom types to be comparable, we must write overloads for comparison operators. There are six of them: two for equality (== and !=) and four for ordering relationships (<, >, <= and >=). There is no restriction on which or how many you implement, how you implement them, or even their return values. This gives you a lot of flexibility and power, but with it comes a lot of responsibility! There are consequences to getting the wrong mix or implementing them inconsistently. For example, we should consider whether ordering makes sense, and if so whether it is strong (distinct values always compare different) or weak (different values may compare equal, leading to the so-called "equivalence"). For many types, ordering makes no sense, but equality does.

Once you have thought through all of the above, you actually have to implement them. This is typically not complicated, but there are gotchas that can be hard to fully test for. Usually, most of the operators can be implemented in terms of one or two that do the actual work, but you still have to write the forwarding functions, which may or may not optimize away. In some you might still need to write custom implementations, for performance reasons.

If you need to compare against interoperable types (e.g. a string type that compares against char const*), you’ll need to do this both ways – in addition to the homogeneous versions. This makes for a total of 18 overloads, with just one alternate type!

It’s no wonder there have been multiple attempts to reduce this boilerplate. The std::rel_ops helper templates are one such attempt, but they have their own problems and are rarely used.
CLion has powerful code generation features for writing these comparison functions for you. This includes options to implement most of them in terms of one or two – as well as using std::tie.

That’s actually pretty good. But with C++20, we’ll be able to write a single overload of the <=> operator, which returns one of three values (hence "three-way") of a type which also indicates its comparison category (strong_ordering, weak_ordering, partial_ordering, strong_equality, or weak_equality) – to implement everything! For interoperable types, you’ll need one additional overload for each (see the CaseInsensitiveString example in the proposal).

In fact, if your comparisons can be expressed in terms of all your data members, in declaration order, then the implementation can be just =default!

You would not normally call <=> directly except when implementing <=> in terms of members, in which case the comparison categories nicely compose. So, for example, you can easily implement a weak_ordering type in terms of strong_ordering members. If you need to do it the other way around, just make sure you’re more explicit.

We think the three-way comparison ("Spaceship") operator is going to be a big win for simplifying our code, making it more expressive and intentional, and helping keep it more correct.

status_code

Status code
P1028
We’ve previously mentioned P0709, "Static exceptions", as a possible future of error handling in C++. One of the supporting proposals for that is P1028, "SG14 status_code and standard error object for P0709 Zero-overhead deterministic exceptions".

The wording of the title implies it’s only relevant in the context of P0709, but that is not the case. In fact, this is a refinement of a facility we have already had in C++ since C++11 – std::error_code (and associated types) in the <system_error> header. This underappreciated type has some really valuable features, for example, being able to define categories (domains, really) of errors that can then be enumerated in separate enum types, while also being able to compare for equivalence across categories (e.g. comparing a platform specific file error against a POSIX one).

std::error_code is a fascinating and valuable design, which is used heavily in std::filesystem and the Networking TS. Still, over the years of use we’ve had with it, the SG14 study group has identified a number of flaws and weaknesses that could be an obstacle to wider adoption and usefulness. P1028 fixes all those flaws with a new, more flexible design, which still interoperates with the old one. In doing so, it also becomes a valuable piece of the P0709 ("Static Exceptions") puzzle, enabling some of the performance and determinism claims of that proposal. For more details on how all this fits together, see Phil Nash’s talk, Dawn of a New Error.

Interviews, tools & techniques, language learning pieces, and thoughts

Talking C++: An Interview with Bjarne Stroustrup

CPP
Whether you’re new to C++ or have been using it for years, check out this interview. Interesting from several perspectives, it includes a classical “look back” part and makes a solid case for why it still makes sense to learn C++ in 2020.

Can you guess what about the original language implementation Bjarne would change if he could? He considers implicit narrowing and value-changing conversions being logically wrong and becoming a major source of errors.

And finally, when you come to Stack Overflow with a question on C++, how would you feel if you got an answer from the language creator himself? In the last part of the interview, Bjarne answers the highest-voted C++ questions on SO.

If you only have a minute to learn how Bjarne feels about C++ today, check out this video by Morgan Stanley: The Invisible Engine of Everything.

C++ Ecosystem: Compilers, IDEs, Tools, Testing, and More

Bartlomiej Filipek made a great cheat sheet for every C++ developer, compiling together the links to various compilers, build tools, package managers, debuggers, IDEs, and more. The annotated list (based on the White Paper created by Embarcadero) gives you a good intro into the C++ ecosystem. The tools mentioned there are essential for every C++ developer, and the list is just the right length, too. If you still want to dig into a longer and more detailed list with libraries and frameworks, all types of development tools, and various learning resources, check out this Awesome-CPP list from GitHub.

Bartłomiej Filipek recently finished his book, C++17 in Detail, which is a very practical overview of all the new features delivered by the latest (for now) signed C++ standard.

Clang Build Analyzer

LLVM dragonAs we code in C++ today, we have to pay more attention to the compiling time performance. The include-what-you-use approach already helps eliminate redundant include chains from your sources, but things might become worse if any templates take too long to instantiate or if the compile-time code generation takes a while.

Aras Pranckevičius from Unity started developing the -ftime-trace Clang option this year, which was later shipped in Clang 9.0 in September. Sony also shared their experience in their blog, listing some sample build time problems.

Now, when you have an instrument to analyze one compiled file at a time, you can think of a tool which analyzes the whole build at once. This tool was recently presented by Aras in his blog post, Clang Build Analyzer.

Do you know the type of char + char?

Char plus Char

Anders Schau Knatten posted a quiz asking for an overload being called when the sum of two chars is passed as an argument. We have to ask ourselves, “What’s the type of char + char?” This involves arithmetic conversions, integral promotions, and other rules from the C++ standard. As it turns out, multiple answers all conform to the standard! Enjoy the post and don’t forget to read the interesting discussion in the comments.

Catching use-after-move bugs

Andreas Kling shared a blog post on a compile-time technique for catching use-after-move bugs he has been using in the Serenity OS project. The basic idea is to use Clang’s Consumed Annotation Checking attribute, mark the class as consumable, and allow some particular states for the objects of that class. Finally, the compiler can generate a warning when a member function is called on an object in an unwanted state. The whole idea looks similar to what Herb Sutter is trying to suggest in the lifetime checks proposal, and more generally to the value borrow checker in Rust.

Pipes

Fluent C++Jonathan Boccara, a well-known speaker and community educator (remember his 105 STL algorithms in one hour?), presents Pipes, a header-only library written in C++14 to operate on collections in a very expressive manner. Obviously, you just assemble the elements of pipes into a pipeline, through which the collection’s data flows. It sounds similar to ranges, and it actually is! However, they cover a few cases which ranges can’t handle. Learn more in the blog post.

Open-sourcing MSVC’s STL

MicrosoftAnother piece of exciting news comes from Microsoft, who has announced at CppCon 2019 that its implementation of the C++ Standard Library is now open source. Being designed by the C++ Standardization Committee (in which Microsoft folks participate a lot), STL is evolving fast, so this looks like a natural move to open-source the particular implementation. Stephan T. Lavavej shared a blog post answering a few questions there, for example, why Microsoft needs this, what the license is, and if there are any further plans like that.

Conditionally explicit constructors

C++20 is close to being signed soon, so it’s time to start learning it step by step. There are some big innovations and some smaller features. This short post from Simon Brand in the Microsoft C++ team blog presents an easy-to-understand and elegant practical use case explaining the need for C++20’s small but useful explicit(bool). Simon shows how to write a wrapper type which preserves the behavior of the stored type in a simple manner, with less code repetition.

The release of C++2a should be delayed

This loud statement is used as a refrain in several posts by Arthur O’Dwyer in his blog on C++ stuff. It is extremely interesting to follow his research in this area and the problems he sees. For example, strong structural equality which breaks on Enums, because there is no compiler-checkable assurance that the user-defined type’s operator== actually implemented equality. Or, some mess with string and string_view. Or, a post in support of Antony Polukhin’s P1485 “Better keywords for coroutines”, whose main idea is that coroutines are distinguished from non-coroutines at a fixed place: to the right of the ) in their function header.

If you want to reflect on modern C++ evolution, the simplification efforts the Committee takes (or does not take) and Herb Sutter’s proposal on error handling in particular, Arthur did a very expressive but still very constructive post after Herb’s closing keynote from CppCon 2019. Check out the series and share how you feel about the current state of C++20!

Releases

We’ll annotate the recent releases briefly, with links for learning more.

  • Qt Creator 4.11 Beta – moved to a CMake File-Base API if you use CMake 3.14 or higher, added support for protocol extension proposal for semantic highlighting, and supported the recently announced Qt for MCUs.
  • Visual Studio 2019 16.3 – the updated C++ IntelliCode base model is now on by default; support is available for parallel builds in MSBuild-based Linux C++ projects; and new C++ Core checks and a new default semantic colorization scheme have been added.
  • Visual Studio 2019 version 16.4 (Preview) – comes with Clang-Tidy for both MSBuild and CMake projects, whether you’re using the Clang or MSVC toolset, and a way to enable Address Sanitizer for projects compiled with MSVC on Windows.
  • CLion 2019.2 – brings an experimental debugger for the MSVC toolchain, an improved Memory View, Parameter Name hints in the editor, and reworked Unused Includes analysis.
  • ReSharper C++ 2019.2 – introduces a new preprocessor implementation to speed up startup times, enriches code completion, expands its C++20 support, and adds a whole set of new features to support Unreal Engine 4 developers.
  • Compiler Explorer with execution support – the title says it all. If you run into any issues, please raise them on the GitHub issue tracker or contact Matt Godbolt directly.

Let us know if our updated digest format works for you, and what other topics you’d like highlighted. Thank you!

The JetBrains C++ Team
The Drive to Develop

Viewing all 678 articles
Browse latest View live