What’s New in ReSharper C++ 2016.1

Apart from the change in version numbers, ReSharper C++ comes with plenty of new features as well as improvements to existing functionality. Here’s what we’ve got in store for you with this release.

Boost.Test Support

The previous release of ReSharper C++ provided a unit test runner for Google Test — well, this one augments this with Boost.Test support. This includes all the usual refinements users of our unit test infrastructure are used to. ReSharper will detect individual Boost tests as well as test suites:

ReSharper C++ Boost.Test Detection

There is also support for test labels:

ReSharper C++ Boost.Test Label Support

And of course it will use its unit test runner to actually run those tests and show a listing of the results.

ReSharper C++ Boost Unit Test Runner

Please note that Boost.Test support requires Boost 1.59 or later.

Todo Explorer

The Todo Explorer is a separate tool window that has long existed in the original ReSharper but is now coming to ReSharper C++. Its goal is to find text that matches a specific pattern in comments, strings or identifiers and show all the located elements in a single, easy-to-browse list:

ReSharper C++ Todo Explorer

There are plenty of filtering and grouping options in this window, and double-clicking each element takes you right to the line of code where the relevant piece of information was found. ReSharper comes with support for TODO and BUG in comments, but you can easily add other markers or create new ones:

ReSharper C++ Todo Explorer Edit Pattern

As the above screenshot demonstrates, you can define the regular expression to search for, the type of code element (comments, strings, identifiers) to search in, and you can also control the color that’s used for this type of item in the Todo Explorer.

Context Actions and Quick-Fixes

As with all releases, we keep expanding the set of context actions and quick-fixes that ReSharper C++ provides. Here are a few examples.

If an out-of-class member function signature fails to match the prototype in the class body, ReSharper C++ now offers two quick-fixes to change that:

ReSharper C++ Change Signature

Choosing Use signature…, the signature of the function definition will be changed to the one of its declaration. Choosing Change signature… does the reverse, changing the declaration so that it matches the definition.

ReSharper C++ Change Signature Refactoring

When ReSharper C++ detects an uninitialized constructor parameter, we now offer a context action to create and initialize the corresponding field

ReSharper C++ Create and Initialize Field

When ReSharper C++ detects possible unintended object slicing, it offers the option to perform a static_cast:

ReSharper C++ Possible Unintended object slicing

If the type of variable being returned from a function does not match the type in the function signature, ReSharper C++ offers the options to adjust either the return type or the type of variable being returned:

ReSharper C++ Incorrect Return Type Quick-Fix

In fact, we have a more general mechanism for detecting type mismatches: for example, assigning an int variable a string literal will present you with the following:

ReSharper C++ Change Type

If you try to assign a read-only member in a const function, ReSharper C++ now offers you quick-fixes to either to make the member mutable or make the function non-const:

ReSharper C++ Make Member Mutable

If a base class or its function has a final modifier, ReSharper C++ will highlight the error over both the final keyword as well as any overriding classes and offer you a quick-fix to make the base class non-final:

ReSharper C++ Remove Final Keyword

New context actions are also provided to flip operator arguments and negate boolean expressions:

We’ve added fixes and context actions for working with includes: analyses related to precompiled header usage, context actions to normalize slashes in include paths, support for replacement of quotes with angle brackets (and vise versa).

ReSharper C++ Quote Replacement

In addition to the bulk generate definitions action, we now have bulk Move Function Implementations context action. Simply select several function bodies and press Alt+Enter:

ReSharper C++ Move Function Implementations

Rename Refactoring Improvements

And there are additional fixes, too. For example, the Rename refactoring now works on files, and will rename both the file as well as any usage (e.g., in #include directives) of the file:

ReSharper C++ Rename Refactoring on Files

It’s also worth noting that the Rename behavior on an ordinary class will now affect the header/cpp filenames, too.

Code Generation

We’ve made improvements in the code generation functionality. For example, when generating relational operators, ReSharper C++ now offers the option of using std::tie:

ReSharper C++ Code Generation Relational Operators std::tie

Another feature we’ve added to the Generate stream operations feature is the support for the use of Boost for purposes of serialization:

ReSharper C++ Stream Output Private Boost.Serialize Operations

And a Few More Things

Starting with version 2016.1, the Find Code Issues functionality works in the background in both ReSharper and ReSharper C++. This lets you keep editing or navigating your code while ReSharper runs its analysis.

The list of C++ language features supported by ReSharper C++ has also been extended with support for generalized lambda captures, exception specifications and inheriting constructors. We also have formatting options now being taken into account when generating code.

The formatting settings have a new page for controlling blank lines.

Finally, all ReSharper C++ actions are now actively banned from changing the code of any of the C++ libraries that you might be using.

So that’s it! Enjoy the new release of ReSharper C++, and be sure to let us know what you think!

This entry was posted in News & Events, ReSharper C++ Tips & Tricks and tagged , , . Bookmark the permalink.

5 Responses to What’s New in ReSharper C++ 2016.1

  1. John says:

    Debug step filter please, come on guys! I want to switch to Re++ but I can’t work without this feature from VAX :-(

  2. Pingback: The Week in C++ for May 14th-20th | Utah C++  Users Group

  3. Pingback: C++ Annotated: March – May 2016 | CLion Blog

  4. Pingback: C++ Annotated: March – May 2016 | ReSharper C++ Blog

Leave a Reply

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