CLion 1.1 EAP starts with massive overhaul of the parser, LLDB integration and new formatter options

Posted on by

Hi everyone,

Summertime and the livin’ is easy, as the song goes. But not for us, as we’re working to bring you CLion 1.1 and announcing the start of the Early Access Program! CLion 1.1 EAP build 141.1935 is already available for download. As usual, it doesn’t require an active license, and you can have both the latest CLion 1.0.4 and CLion 1.1 EAP installed on your machine.



Summer is a hot season, but the hot features we have inside CLion could give it a run for its money. Let’s check them out!

Big parser improvements

You probably know that C++ is a very complicated language to parse. There are so many interesting cases where the overall context can influence the way your code is parsed. Since April we’ve completed a massive overhaul of our parser to make it more accurate and precise. Let me show you a few samples.

Sometimes a function declaration looks very similar to a constructor declaration, but the IDE needs to distinguish them to provide appropriate highlighting, code analysis and refactorings for your code base. Starting with 1.1 EAP, CLion can correctly handle many contexts like the one below:





Another similar example is casting a value to some type vs. declaration of a variable:



Our latest work also affects the parsing of template arguments (CPP-3802, CPP-3758, a fix for the variadic templates CPP-3754), and various typecasting cases like the one below:



These enhancements, introduced deep in the parser, allow us to fix many false positives with incompatible pointer types (CPP-3610, CPP-3612), as well as some initializer warnings (CPP-3613, CPP-3511).

Many other related fixes and improvements are available. If you’ve come across red code or false positives in your code base, give CLion 1.1 EAP a try and share your feedback with us!

LLDB integration on OS X

One of CLion’s key advantages over a plain text editor is the debugging experience. While you can always run a stand-alone debugger separately, debugging inside an IDE saves you time and provides various additional functionality.

Since its very first build, CLion integrates with the GDB backend on all platforms, providing all the essentials in its UI. However, OS X users feel more comfortable with the LLDB. So we’ve improved CLion to provide a more natural experience for that use case as well:



We’ve bundled version 3.6 into the OS X distribution package, making it the default debugger on OS X. If you use CLion 1.0 on Mac and you install this EAP build, your debugger will be switched to the LLDB for the first time. After that you can either stay with LLDB or come back to GDB manually; your settings will be stored in CLion.

Formatter accuracy

CLion keeps your code well formatted as you type. Alternatively, you can apply formatting rules explicitly with the Reformat Code action. You can also configure the coding style guidelines in Editor | Code Style settings and have CLion make sure you stay compliant with them. To help you reflect your desired guidelines more precisely, CLion 1.1 EAP introduces a set of improvements and new options for configuration.

Most of the improvements have to do with the preprocessor directives and conditionally non-compiled code. CLion 1.1 EAP brings a number of new settings for directives ( #define , #if / #endif ) indentation to Editor | Code Style | C/C++:

In Tabs and Indents | Preprocessor directive indent, the default value is 0, and the relative indent is applied to the nested directives:



Follow code indent, placed below, is responsible for keeping the indent of the directives the same as for the surrounding lines ( off by default).

by default). In Wrapping and Braces, Keep when formatting group, there is a new option, Directive at first column. It is set to yes by default, and is responsible for keeping the directive in the first column (if it’s already there) in any situations, regardless of other options.

When you start typing ‘#’, CLion will now automatically align this new directive to the correct position. The closing ‘#’ directive (or ‘else’) is aligned after you press Enter :



The guard block is an exception for the preprocessor directives’ relative alignment and is handled automatically. The code that is conditionally uncompiled is now formatted correctly, following the configured Code Style settings.

Non-existent declarations no longer break template formatting (CPP-3411). And multiline comments are now handled correctly during auto indentation.

Completion for missing keywords

We’ve also implemented missing completion for a few keywords, including:

final

override

alignas after struct

noexcept

friend

C and C++ files extensions

Since this build you can configure the preferred C/C++ source/header files extensions and use these combinations while creating a new C++ class, C/C++ source or header file. To add/update file extensions go to Editor | Code Style | C/C++ | New File Extensions settings:



These file extensions are available when creating a new C++ class, C/C++ source or header file:



Custom JDK update

In CLion 1.1 we’ve introduced a custom build of JDK 1.8 with fixes from the JetBrains team. It was very warm welcomed, however had some critical performance problems. This build addresses these issues, as well as a problem with high CPU usage. CLion 1.1 EAP build including updated custom JDK is located on confluence page.

The full list of fixed issues can be found in our tracker.

This is just the beginning for CLion 1.1 as we’ve got more interesting features coming soon! Check out this EAP build, follow the updates and report any problems found to our tracker. Your feedback is always extremely welcome!

Develop with pleasure,

The CLion Team!