CLion 2016.2 release: remote debugging, Doxygen format support, new code generation features and much more

    Hello, Habr!

    A little over a year has passed since the first release of our cross-platform IDE for development in C and C ++. During this time, we have tens of thousands of users, among clients there are organizations such as NASA and AirBnB, and the most popular request in the tracker scored more than 500 votes. And by the way, we are not in vain asking you to vote for those requests that are most interesting or relevant to you. Our turn of development tasks depends on your opinion and your votes in the first place. That is why the release of 2016.2 includes so many long-awaited features!

    And now, first things first.

    Debugger: performance, correctness and new supported versions

    Our users often complained about various problems with the debugger in CLion - either the command timeout happens during program debugging, the variable values ​​in the Variables window are not updated, the debugger finishes its work incorrectly. To all this was added a performance problem when using the debugger on programs with bulk data structures became difficult.

    Having collected all the logs and reports from our users (by the way, thank you very much for them!), We were finally able to significantly rework the drivers for the GDB / LLDB debuggers used in CLion. A lot of problems were solved (in particular, the one with the command timeout), and most importantly, the performance of the debugger improved significantly (in 600time!). So, for example, in our tests, the speed of step-by-step debugging of programs with viewing arrays improved 600 times for GDB and 1-2 times for LLDB; with expanded content of classes - 160 times; and many tests (for example, debugging with viewing strings or STL collections), which were previously timed out, began to finish in a reasonable amount of time.

    At the same time, we updated the supported versions: GDB to 7.11 , LLDB to 3.8 , and with them MinGW-w64 to 5. * and Cygwin to 2. * .

    LLDB in CLion is now available not only to our users on macOS, but also on Linux.

    Debugger: remote debugging with GDB

    I am sure many of you have been waiting for this opportunity. We’ll immediately make a reservation that for now this is the very first implementation of how we see remote debugging in the IDE. So, if you know about useful use cases that we have not considered, be sure to tell us about them.

    So, the current implementation involves debugging with a GDB and a GDB server . The latter runs on the target host, and you just have to correctly configure the Remote GDB Configuration settings in CLion for remote connection. When the connection is successfully established, you can debug the remotely launched program by setting breakpoints in the IDE, viewing the values ​​of variables or even changing them on the fly, and calculating the values ​​of expressions.

    The interface for configuration is quite simple and includes those parameters that you would use by manually setting up GDB / gdbserver:

    Currently, remote debugging is not available on Windows. MacOS also requires the use of a special version of GDB compiled with a flag --target=x86_64-linux-gnu( see here for more details ).

    Documentation: Doxygen Support

    As you know, a good degree of documentation of the code is a guarantee that the code will be easier to maintain in the future. In C ++ development (and not only), one of the most popular code documentation formats is Doxygen . Therefore, we decided to add its support to this version. What does it consist of?

    First, for code documented using Doxygen comments, the Quick Documentation window ( Ctrl+Qon Linux / Windows, F1on macOS), in addition to information about the type of element, displays a preview of the documentation. Of the convenient features, it is worth noting that if the parameters of the function in the code are documented separately, then the Quick Documentation for the function will be able to combine all the comments and show a general description of the signature:

    In addition, if you open the Quick Documentation window when the cursor is on the parameter name in the Doxygen comment, information about the type of this parameter will be displayed:

    Secondly, when refactoring a function, if, for example, you decide to rename its parameter , Doxygen comments automatically updated:

    Well, finally, if you decide to add new Doxygen comments to the project code, use auto-completion for Doxygen commands and function parameters. Or simply generate a documentation template for its further filling (works when using “/ **”, “/ *!”, “///” and “//!”, Provided that the documented function has parameters, it returns the value or throws an exception):

    The appearance settings of the generated templates are in the Editor | Code Style | C / C ++.

    Complete statement

    Although this is not a new feature, in version 2016.2 it has been significantly redesigned and improved. The bottom line is that CLion completes the code constructs for you by placing the necessary brackets, semicolons, quotation marks, and also moving the cursor to the position where you can start printing the next construct. This works for namespaces, classes, structures, control structures, etc.:

    Read more on our blog .

    Code generation

    CLion allows you to save time on code printing by providing various options for code generation: from generating class constructors / destructors to a variety of live templates. In version 2016.2, we added the ability to generate comparison, equality, and print operators (stream output). The flexible interface allows not only to select the fields of the class that you want to use, but also to indicate whether to create operators as members of the class, whether std::tieto use them in the implementation, etc. In this case, CLion analyzes whether there are already any operators in the class from those which the user wants to generate, and can either recreate them or add the missing ones:

    In the last release, we introduced the ability to generate definitions(generate definitions), while the implemented behavior of choosing the place where CLion places the created definitions caused a lot of controversy and discussion. We analyzed all the comments of our users and in the 2016.2 release we changed the behavior, making it adaptive. In fact, CLion itself recognizes and supports three main models:
    • declarations are located in header files, implementations are in .cpp files;
    • classes / structures are completely located in header files;
    • classes / structures are completely located in .cpp files.

    Of course, you can change the model you use at any time while generating definitions. CLion will remember the new behavior and offer it to you the next time you call the generation function:

    Smart CMake Support

    We continue to work on facilitating the writing of CMake code in projects. In this release, we have supported two refactoring for CMake:
    • Rename ( Shift+F6on Linux / Windows, ⇧F6on macOS) - allows you to rename custom characters, functions and macros. CLion itself will update all use cases.
    • Safe delete - from one of the very first versions, when adding a new file to the project, CLion suggested adding new files to CMake targets. Now the removal of files from the project is also supported, namely, all references to the file will be deleted from the CMake commands. And if the CMake files may turn out to be incorrect after deletion (if the deleted file was the last argument of the command), a warning will be displayed:

    We were often asked to make a way to determine if the CMake call came from CLion. In this case, many users would like to be able to set additional variables or change some used paths. Now there is such a way - the environment variable CLION_IDE . And to make it easier to find, auto-completion for environment variables has been implemented:

    Code formatting

    CLion offers many formatting options and predefined styles. In the new release, in addition to several new options, new styles were also added - LLVM and LLDB .

    General IntelliJ Platform Improvements

    The release of CLion 2016.2 also contains general changes in the IntelliJ platform:
    • Windows users are now (as before, Linux and macOS users) an assembly with a custom JDK that contains corrections and improvements from the JetBrains team.
    • Support for fonts with ligatures (included in the settings Editor | Colors & Fonts | Font, select a font with support for ligatures and enable the option “Enable font ligatures”):

    • For those who love background screensavers, background support is added in the editor. To enable it, call Find Action ( Shift+Ctrl+Aon Linux / Windows, ⇧⌘Aon macOS), enter Set Background Image , specify a file with a picture and adjust the transparency and other background settings.
    • Support for Version Control Systems has received many improvements:
      • Files that are not included in the current repository are now specified in the commit window in a special way so that you do not forget them.
      • The Git and Mercurial log is loaded in the background upon any change (both when loading the project, and when changing in the local repository), so that you are always ready when you switch to it.
      • For Git, we fixed an unpleasant problem that Windows and macOS users are likely to encounter: renaming files where only the case of characters is changed.
      • To improve the work with patches, the ability to copy via the clipboard (or simply drag and drop the file with the mouse) has been added - the IDE will automatically offer to apply the patch.
      • In addition, if the files affected by the patch have been renamed or migrated, the IDE will try to find them or ask you to specify a new path.
      • And immediately before applying the patch, its contents can be compared with a local copy and, if necessary, make some changes.


    Since the last release, a plugin for writing Swift code has appeared in CLion . It is especially interesting for those who are currently developing Swift on Linux. The AppCode team continues to work on language support, not forgetting (for which many thanks to it!) To port the changes to the CLion plugin. This version adds support for Swift 2.2, as well as the long-awaited refactoring - Introduce Variable, and templates for parameters (parameters placeholders) are supported. Find out more on the What's New page of the new version of AppCode 2016.2 .


    And traditionally, a short video (in English) demonstrating the new features of CLion 2016.2:

    You can read about these and other features of the new version on the product website . Stay tuned for articles on our English-language blog . As usual, there is a 30-day free trial , and in the price section you can find out about the cost. We will be happy to answer any of your questions in the comments.

    Your JetBrains CLion
    The Drive to Develop Team

    Also popular now: