CLion 2017.2 released: Clang-Tidy, Force Step Into, better C++ support and performance improvements

Please welcome the new release of your favorite cross-platform C/C++ IDE – CLion 2017.2! Focusing on C++ correctness and performance improvements, it also brings Clang-Tidy integration to expand the number of code analysis checks, a better way to get disassembly view, and lots of bug fixes and other improvements.

800x400_Clion_2017_2_Released@2x

Read on for details and get a free 30-day trial to evaluate all the new features and enhancements:

Download CLion 2017.2

Better code quality: Clang-Tidy integration

CLion has 30+ code built-in code inspections to alert users to unused code, incompatible types, wrong declaration order, uninitialized variables and so forth. It also performs Data Flow Analysis to catch infinite recursion, endless loops, missing returns, and unreachable code. To expand the list of checks and help you ensure better code quality, we’ve integrated Clang-Tidy into CLion 2017.2.

In CLion Clang-Tidy checks are shown the same way as CLion’s own built-in code inspections, and quick-fixes are also available via Alt+Enter:

modernize

cppcoreguidelines

Clang-Tidy’s list of checks is long and impressive, and CLion got most of them enabled by default. To customize the list of checks and tweak it to your needs, as well as company policies and standards, go to Settings/Preferences | Editor | Inspections | C/C++ | General | Clang-Tidy settings and use the text-formed string in the Clang-Tidy command line format:
clang_tidy_settings

Enable C++ Core Guidelines or Clang Static Analyzer checks, try Modernize checks and many others. It’s even possible to add your own checks to Clang-Tidy and get them automatically in CLion. However, be sure to use JetBrains’ fork of Clang-Tidy (LLVM, Clang, Clang Tools)
until our patches for the output format and response files (patch 1, patch 2 part 1, patch 2 part 2) are accepted into LLVM master.

To read more about the integration and our plans for expanding it, see this blog post.

Update
CLion 2017.2.2 EAP comes with an easier way to disable particular checks, as well as compatibility with Clang-Tidy from LLVM master. Read more.

More accurate C++ parser and enhanced quick-fixes

Looking ahead, we’re planning a major overhaul of CLion’s C++ parser. Starting from bottom to top, we will ensure it is correct on each level, unmasking hidden problems on the way. Some work has already been done.

At the same time, CLion 2017.2 brings dozens of fixes in various parts of the C++ parsing and resolving engine. From the user perspective, it means a reduced number of false-positive code analysis checks, more accurate navigation, refactorings, and other benefits.

If you are interested in the full list of fixes, please see our tracker.

In addition, CLion 2017.2 comes with a new quick-fix to preserve non-trivial constructor calls on an unused variable. It can be used for the cases when constructor still does some useful work:
unused_var

Besides, when the cast is needed in C++ code, CLion now suggests C++ type casts (static_cast, dynamic_cast, reinterpret_cast, const_cast) instead of C-style casts:
cast_operators

You can turn this behaviour off in Settings/Preferences | Editor | Code Style | C/C++ | Code Generation | C++, if necessary.

PCH for Microsoft Visual C++ compiler

If you use CLion’s experimental support for Microsoft Visual C++ compiler, you’ll be glad to learn that precompiled headers are now supported for this case (in addition to previously supported GCC and Clang). Note there are some limitations to keep in mind.

Easy start with C++17

C++17 will be officially signed later this year, but as we see, many C++ developers have already moved to it or at least plan to do so. That’s why we’ve added C++17 to the list of standards in the New Project wizard. This means CLion will automatically add set(CMAKE_CXX_STANDARD 17) to the CMakeLists.txt generated for the new project.
cpp17_wizard

Force Step Into for disassembly view

Disassembly view (for GDB) was recently added to CLion 2017.1, and now we’re adjusting its behavior based on your feedback. Some users have been facing the problem of getting into disassembly code unexpectedly, whereas they would prefer to simply skip all the frames without sources. That’s why we’ve relocated the functionality to the Force Step Into Shift+Alt+F7 action, while the usual Step Into F7 skips the frames without sources. We hope this makes the feature easier to use and more intuitive.
Besides, the name of the tab with the disassembly view was updated to show the name of the currently running configuration:
force_step_into

Note, that on macOS (when using GDB) Step Into still falls into disassembly view on std function calls and in some other cases (CPP-10181).

Debugger fixes

To improve the debugging process in CLion, this release comes with some important enhancements and fixes.

To inspect elements of array with big indexes without constantly clicking Expand to the next 50 elements, you can adjust the value cidr.debugger.value.maxChildren in the Registry. (Open the Find Action dialog (Shift+Ctrl+A on Linux/Windows, ⇧⌘A on macOS), type Registry, and then type cidr.debugger.value.maxChildren in the Registry to search for the setting.) However, remember that this change may lead to increased timeouts during array evaluation while debugging and may affect the IDE in general (beyond your current debug session or project).

Other fixes implemented in the GDB driver include:

  • Command time out when trying to attach to a non-existent local process
  • Incorrectly escaped backslashes in program arguments on Windows

Automatic Run/Debug configurations for Google Test

To perform unit tests with ease, CLion provides a built-in test runner that allows you to rerun tests/failed tests in one click, export results, navigate to the sources, and view the results in a tree view. To get the test results there, a special Run/Debug configuration should be used. For Google Test it can be created automatically by CLion for every target linked with gtest, and now with gmock.

Non-project files

Non-project files (files that do not belong to any CMake target) can now be identified easily in the editor, thanks to the the new file-wide notification:
not_in_prj

For CLion it means that code insight features should be limited in such files, for example refactorings should not be performed.

It might be useful to know, that when you create new C++ class or C/C++ source or header file CLion suggests to add a new file to CMake target and suggests most probable options to select from. Use this feature to get all your new files included into CMake targets.

Improved performance

Our team is constantly working on performance improvements, doing our best to make the IDE responsive and effective. Thanks to many CPU snapshots, logs and sample projects that you’ve shared with us via tech support and the CLion tracker, we can identify the areas that can be improved and make the appropriate changes.

The first performance enhancement in CLion 2017.2 is cancelable actions. The idea is to use them where possible to prevent time-consuming operations from freezing the IDE. This time we’ve updated Go to subclass and Go to overridden functions actions, which build a list of options and can require quite a lot of time to finish. To cancel the action, simply click to the area out of the navigation popup:
cancelable_goto

Another time-consuming operation is CMake reload. You can now cancel it at any time, by simply clicking the Stop button in the CMake tool window. The output logs were updated to get the indication of successfully finished reload (to distinguish from a canceled run):
cmake_reload

Among other performance-related changes:

  • We’ve fixed laggy Enter and Backspace on some projects (for example, when the caret enters a new block, moves to a new line, or causes a code indent).
  • We’ve shortened indexing time by optimizing the way compiler-predefined macros are parsed in CLion.

Find in Path UI enhancements

In version 2017.1, the Find in Path window turned into a convenient and compact popup with immediate preview. CLion 2017.2 brings several improvements to make the UI more functional:

  • A left-side gutter is now available in the preview, with navigation icons, and markers for local changes.
  • To make the preview even more compact, results from the same line are merged into one line in the preview panel.

find_gutter

Do more with new VCS features

Thanks to IntelliJ Platform, this release brings lots of improvements for Version Control Support:

  • If you need to revert some commits, select them and run the Git command Revert from the Git Log view.
  • To fix a typo in a commit message, or just to update it, use the Reword action (applicable to any commit that has not been pushed yet).
  • To keep commit messages easy to read and expressive, use new Preferences/Settings | Version Control | Commit Dialog settings. Configure whether to have a blank line between subject and body, set maximum text length, and check the spelling in your comments.
    commit_messages
  • A quick-fix and the Reformat action are available in commit messages:
    commit_message_inspection

That’s it! Explore all the new features in even more detail on our website (or play with a demo project). Start your 30-day free evaluation and try out all these new features and fixes.

Download CLion 2017.2

Your CLion Team

JetBrains
The Drive to Develop

This entry was posted in Announcement and tagged , , , , , , . Bookmark the permalink.

62 Responses to CLion 2017.2 released: Clang-Tidy, Force Step Into, better C++ support and performance improvements

  1. John says:

    Awesome! Will there be a patch update from 2017.1.3? Currently CLion 2017.1.3 says there are no updates available on the Stable channel.

  2. Zhou says:

    Congratulations!
    But there were still some bugs to be handled, for example, when we debug pretty print does not work for unordered_map and unordered_set, some people have mentioned it in bug tracker, hope it will be fixed soon!

  3. Vile Lasagna says:

    Maybe it’s time to try it in the Crappy Lappy again. Performance for that sorry pc is one of the things still keeping me from jumping over. You guys have been pretty dangerously close to actually “stealing me” from Qt Creator =P

  4. John says:

    Is there a way to check the version of Clang-Tidy that is bundled? If not, could that be added somewhere like the Toolchains settings page? Would be helpful when trying to compare the output to the command-line version or when fixes are applied upstream that might not be yet merged into the bundled version.

  5. Syndog says:

    One of the strengths of JetBrains IDEs is their insightful analysis and suggestions for keeping code compact, clean and legible. I see Clang-Tidy as a logical extension to that strength, so kudos for that.

    However, the first thing Clang-Tidy did was give me a warning for which there was no suggested remedy. The issue it pointed out is of marginal impact, so I’m disinclined to change the way I’m doing things in the code. My only recourse is to A) riddle my source files with ugly #pragma directives disabling Clang-Tidy for each of these cases or B) disable all of Clang-Tidy entirely, which strikes me as throwing out the baby with the bathwater.

    It would be so much better if I could disable just that particular warning, but I don’t see any apparent way of doing so.

  6. Olof says:

    Thank you for this release and the focus it had on performance and correctness.

    I’d like to continue to push for correctness and performance though. That is still the most pressing issue for me (and people around me).

    • Anastasia Kazakova says:

      Thanks Olof! We do our best to find and keep a good balance between new features, bug fixes, general improvements and performance.

  7. Victor Sergienko says:

    The infamous icon design issue IDEA-159933 “all Jetbrains prodicts look the same like a terminal/Photoshop icon” was recently marked “Fixed” with a comment “We have an updated set of icons for 2017.2 releases”.

    Were the icons approved? I cannot see any change in the app icons.

  8. I’ve updated just 2 hours ago and now Clion git intergration shows me, that I’ve changed 2 files, but they haven’t changed and git from console also says that. When I open commit dialog he also says that they identical, but show them in commit window. I think I not he only person with such bug, please fix that!!!

  9. Ivan says:

    In the latest release I keep running out of heap memory. I increased my heap size up to 20GB and invalidated caches / restarted. My code is heavily templated which makes me suspect some inspection that gets stuck in a recursive template call but I don’t know. I also use boost extensively. Unfortunately, I cannot submit a memory dump because the source code I am working on is proprietary and I don’t know what exactly causes the problem.

    • Anastasia Kazakova says:

      Memory dump doesn’t include any user code and we would appreciate it a lot. Our tests doesn’t show any significant degradation, so this could be some specific case you have and we need some dumps to investigate.

      • Anastasia Kazakova says:

        Sorry, I’m not accurate here. Memory dumps do include some sensitive information about the files currently opened in the editor, as well as project symbols. However, I’m afraid that without the dumps its will be quite difficult to diagnose the problem. Maybe you could share some general information about the project, libraries used, etc.?

        • Ivan says:

          Yes that is what I noticed about the memory dump when I opened it on my editor. However I created an issue: https://youtrack.jetbrains.com/issue/CPP-10347

          I am currently able to reliably reproduce the error when opening a particular file so I’ll try to isolate it.

          • Anastasia Kazakova says:

            Thanks. I guess boost::fusion might cause some issues, or some templates used in your code. If you could come up with some small sample to reproduce, that will be great.

  10. Vadim Peretokin says:

    Appreciate the improvements, especially performance-related! Thank you!

  11. John says:

    Are there any Doxygen polishing improvements planned for 2017.2.x or 2017.3? Some of them would really help my team more easily read and write documented C/C++ code.

    Coloring Doxygen parameters
    https://youtrack.jetbrains.com/issue/CPP-10311

    Highlight incorrect Doxygen parameters
    https://youtrack.jetbrains.com/issue/CPP-9282

    Doxygen markdown support
    https://youtrack.jetbrains.com/issue/CPP-8590

  12. John McRay says:

    Oh yeah, new update! Good news! Thank you!

  13. Karl says:

    Great improvements!

    However I found the toolbar containing file path and search everywhere that used to sit above file tabs was gone after the update. Is there anyway to bring it back? I can find search everywhere by turning on main toolbar, but the file path is still missing…

    • Anastasia Kazakova says:

      Search everywhere is still there. Maybe you turned off the Navigation toolbar? Check in View | Navigation Bar.
      Also search everywhere could be invoked with Double Shift

  14. Sergey says:

    Quick search for files is broken after the update:
    If you choose Navigate|File… and the search string is not empty, the popup disappears automatically.
    My OS debian stretch, DE Gnome 3.
    But everything works well on Windows 10.

  15. Konstantin Isakov says:

    I’d like to chime in again one last time noting CPP-1100 still not being fixed. The last entry mentions that it may get delayed until 2017.2, yet it’s still open. I’d like to remind everyone involved in CLion production that C preprocessor is core part of not only C++17, but every C++ standard starting from the initial C++98. That is, it has been there from the start, yet you still keep neglecting it.

    My impression is that #include, for instance, is assumed by CLion’s team to be some sort of poor-man’s analog of Java’s import. However, the #include directive at its core does nothing more than a simple copy-paste during the preprocessing stage, and a lot of projects use that to their advantage. While it’s a popular trend for some to say that the preprocessor is a relic that shouldn’t be used at all, I personally find it indispensable for certain tasks, and find it unacceptable for an editor not to support it properly.

    The C++ preprocessor is not deprecated nor frowned upon by the C++ standard – it’s described on an equal footing with classes, templates, lambdas and everything else which C++ is. You can’t claim to support C++ standard properly without supporting the preprocessor’s part of it properly as well.

    It’s been more than two years since the original bug has been opened.

    • Anastasia Kazakova says:

      You are absolutely right that C++ includes are different from Java imports, and of course they are important and also not that easy to handle (as their parsing depends on the context). I just want to say that we investigated this issue for quite a long time and failed to come up with some easy solution, we also spent some time on analysis all the possible options but didn’t manage to implement ready-to-use solution in 2017.2. We’ll be back to this ticket during this release cycle and hopefully can come up with some improvements.

  16. Dave Yost says:

    Is there a list on youtrack where you track compatibility with language features in the C++ standard? That’s what you should link to from these blog posts.

  17. Dawid says:

    Hi, sorry for being late.

    I was getting quite frustrated with 2017.1 and I was considering changing IDE. With this release I am so happy, that I stayed with you. It’s so much better, than it was before, and I am not talking about new functionalities, but bugs and false positives mainly. Once again thank you so much!

    • Anastasia Kazakova says:

      Thanks a lot for such kind words! We are really happy you decided to stay and we do hope you will enjoy using CLion.

  18. Olof says:

    Just recently, I think coinciding with 2017.2, or maybe a recent EAP my CLion has gotten dramatically slower. It could be that it is unrelated to CLion because I recently changed my disk configuration to make my HD be one partition instead of two, but that is the only change. It did put my home directory and my ~/.CLion folder to the same partition.

    A colleague of mine is running on the same type of machine, same version of CLion and we are using the same project. Building symbols takes less than 2 minutes for him. I am at 20 minutes now and I’m not even half done with building the symbols.

    My system does not seem to be maxing out CPU nor HD usage. I’ve turned off almost every single plugin grasping for straws but no luck.

    What should I do to try to figure out what is going on?

    I’m thinking this is a worthy cause to figure out because who knows, maybe this is a simple fix that could make CLion 10 times faster for those who are experiencing performance issues. And maybe that’s a large percentage of the total installed base.

    • Olof says:

      I’ll add, I even tried a clean install by deleting my ~/.CLion-something folder and deleting my build folders. I also made sure to have only one configuration, the Debug configuration.

    • Olof says:

      I am now more than 40 minutes in and still not half done. What I’m observing though is curious. iostat shows that the I’m not likely disk bound and htop shows that I’m using maybe a few of the 32 cores I have.

      avg-cpu: %user %nice %system %iowait %steal %idle
      1.89 0.11 0.15 0.00 0.00 97.85

      I should also mention that I’ve tried with Xmx set to 6GB and 2GB. My colleague used 2GB for the less than 2 minutes run.

      Nothing is appearing in idea.log.

      I’m currently running with 2GB and the memory indicator is showing that I”m using almost all memory. The thing though is that when I am running with 6GB I’m also at the edge of memory available. I’m not saying there is a memory leak, but it behaves as if there is a memory leak because it keeps bumping up towards the upper limit and each garbage collection gives back less and less.

      I’m going to kill this attempt now and try with a larger Xmx.

    • Olof says:

      Sorry about the spam, but we have found something interesting.

      We tried bisecting the problem by running many different variations until it got fast, his binary, my binary, his machine, my machine, my repo, his repo.

      In the end it turned out that removing the .idea folder in my repo did the trick. I think that my .idea folder probably was from prehistoric times and maybe there was something old in there that tripped up CLion.

    • Olof says:

      Sorry about the spam, part 2.

      The reason I tried to rebuild the indexes was because the latency in the editor was unbearable. Like moving the cursor would have a 5 second latency.

      That latency is also gone.

      Also, the memory usage is now much lower.

      • Anastasia Kazakova says:

        I’m really sorry for not replying ealier. Am I right it’s all ok now? And yes, .idea directory may store some old information and actually Invalidate Caches and Restart action may help here. But good to know that it works for you now.

        • Olof says:

          Hey,

          Thanks Anastasia. Yeah, it’s back in working order.

          Thanks.

          PS.
          I’ve noticed that 2017.2.1 is out but I’ve seen no announcement here. Will new point releases no longer be posted here on this blog?

          • Anastasia Kazakova says:

            We skip the bug-fix announcement in blog if there is nothing except the platform bug-fixes included into it and if there are no major bug-fixes that can affect lots of CLion users. In such cases, we only post release notes to confluence and do a tweet and in-product update notification. In all other cases we will post to blog about the changes.

  19. Fabian says:

    Hey,

    I am successfully using googletest in CLion. However, Im unable to debug through my google test. To configure the test I have created a folder test inside my project and opened it in a new CLion window since my test folder contains an own CMakeLists.txt and dynamically gets gtest and gmock from git. This structure is also needed to keep the production code clean from any test code.
    As said before, tests work perfectly inside CLion. However, Im unable to debug (breakpoints have no effect). I really need to debug my tests! Do you have any advice?

    Thanks in advance for your help.

Leave a Reply

Your email address will not be published. Required fields are marked *