What’s New in ReSharper C++

ReSharper C++ 2022.3 introduces experimental support for C++20 modules and provides seamless integration with clang-format. For Unreal Engine projects, this release brings new Blueprint-specific inlay hints and improves the Rename refactoring by adding Core Redirects.

Download

Free 30-day trial available

C++20 modules

ReSharper C++ 2022.3 adds experimental support for arguably the most significant update to C++ since the original C++98 standard: C++20 modules. Modules introduce a new compilation model, where instead of using header files, you split your code into independently compiled components.

In new code, you should use named modules, which explicitly declare their interface in .ixx module interface files. But in order to make the transition easier, C++20 also provides a way to use existing, well-behaved header files as modules through header units. Both ways to create and consume modules are now supported by ReSharper C++.

First of all, ReSharper C++ now properly handles the new syntax: module declarations that introduce modules and module partitions, import declarations that consume other modules, and the export of entities from module interfaces. And like it does for include directives, ReSharper C++ will warn you about unresolved module names or paths in import declarations.

In code navigation, all the features you’re used to now work for entities imported from modules. With support for module declarations, you can now use Go to Declaration on the module name in import declarations, navigate to module declarations from File Structure, and search for modules with Go to Symbol.

If you want to quickly create a module, you can use a new built-in file template – Module interface unit. To create a new file from a file template, use the Ctrl+Alt+Insert shortcut or select ReSharper | Edit | Create New File from the main menu.

Among the features that benefit from modules support is code completion. The code completion list now includes items from all the imported modules and header units.

This is still a work in progress, and there are some known limitations. Learn more.

C++ support

We’ve introduced support for the #pragma pack directive, which modifies the current alignment for classes and structures. ReSharper C++ now correctly computes the size of packed structures.

In ReSharper C++ 2022.2, we implemented a lot of improvements for working with emplace-like and make-like function calls. However, these features were limited to classes and functions from the standard library. In this release, ReSharper C++ can show you parameter info and inlay hints for any similar function defined in your code.

To let ReSharper C++ know that a function implies a constructor call, make sure that the function template parameter is constrained (using SFINAE or a requires clause) to be constructible from the given arguments pack.

ReSharper C++ 2022.3 introduces support for the extended C++20 version of [[nodiscard]], which includes a reason why a function or a class has been marked with the attribute. Now you’ll get a clearer warning with the specified reason when the result of a function call is not used.

This release also brings improvements for compile-time evaluation. ReSharper C++ now correctly handles various forms of object initialization, including the evaluation of constructors of any kind – default, implicitly generated, inherited, and user-defined.

We’ve also improved the support for calling conventions. ReSharper C++ now understands the GNU style for specifying calling conventions in function declarations for compilers that support this syntax (void __attribute__((stdcall)) bar()).

Unreal Engine

If an asset is affected by renaming a symbol, Unreal Engine will no longer recognize it. To prevent data loss, ReSharper C++ suggests adding a Core Redirect when you perform the Rename refactoring. If accepted, the corresponding .ini file is updated automatically.

The Add Core Redirect option was already available for UCLASS and UPROPERTY, and now it also works for UFUNCTION, USTRUCT, and UENUM.

ReSharper C++ 2022.3 introduces a new Blueprint-specific inlay hint. You can now quickly check how many blueprints use a function marked with the BlueprintCallable specifier and get a list of all usages from the hint’s context menu.

ReSharper C++ no longer offers unwanted entities from system headers and shader files in auto-import suggestions. You can enable system header suggestions in Options | Code Editing | C++ | Unreal Engine.

ReSharper C++ 2022.3 also includes updates for the latest Unreal Engine 5.1 version.

If you are interested in a stand-alone cross-platform IDE for Unreal Engine development, consider Rider. Unreal Engine support in Rider and ReSharper C++ is aligned, and you can expect the same improvements in the Rider 2022.3 update.

Code formatting

ReSharper C++ 2022.3 provides seamless integration with clang-format as an alternative code formatter. You can now switch between ReSharper’s own formatting engine and сlang-format when formatting files.

ReSharper C++ runs the clang-format binary in a separate process, ensuring full compatibility with the industry-standard formatter, as well as better performance and a more extensive range of formatting options.

By default, ReSharper C++ uses the built-in clang-format binary. You can configure ReSharper C++ to run any other clang-format binary on the Code Editing | C++ | Formatting Style | General page of the ReSharper options.

For those who prefer ReSharper’s own formatter or would like to quickly set up the formatting style via Detect formatting settings, ReSharper C++ 2022.3 introduces some new formatting options to configure:

  • Spaces before and after ellipses (…) in parameter packs.
  • The number of blank lines that are acceptable in declarations and in the rest of the code.
  • Whether blank lines are kept or removed after an opening brace ({) and before a closing one in declarations and in the rest of the code.
  • Blank lines before and after access specifiers.
  • Alignment of enumerator initializers in columns.

Coding assistance

ReSharper C++ now shows the origin of a function in parameter info and other tooltips, identifying whether a function is implicitly generated (e.g. constructors or assignment operators), built-in (e.g. operator + for fundamental types), or a compiler intrinsic (e.g. functions with the __builtin_ prefix).

There are two useful new additions to help you make conditions more readable:

  • A context action that replaces && with || and vice versa inside boolean expressions, following De Morgan’s laws.
  • An inspection with a quick-fix that simplifies negated comparison expressions.

We’ve also updated the bundled Clang-Tidy binary to Clang 15, adding new checks from the latest LLVM release.

Take a look at What's New in ReSharper to learn about the other changes introduced in this release. For example, ReSharper now alerts you about vulnerable dependencies associated with the use of NuGet packages.

Download

Free 30-day trial available

ReSharper C++ 2022.2

Unreal Engine

ReSharper C++ introduces Blueprint-specific inlay hints and allows you to see the bigger picture behind your code:

  • Be aware of derived Blueprint classes and check out the list of all inheritors.
  • Spot that a UFunction has implementations in Blueprints and search for all such cases.
  • Quickly check the state of a UProperty, including whether it has been overridden and what value is set in the Blueprint file.

We’ve also introduced two inspections to let you know if there are inconsistencies between the Blueprint-specific function specifiers used in the code and the Blueprints themselves:

  • A UFunction with the BlueprintCallable function specifier is supposed to be used in a Blueprint, but no usages are found.
  • A UFunction with the BlueprintImplementableEvent function specifier is supposed to be implemented in a Blueprint, but no implementations are found.

We’ve significantly improved the indexing speed of Unreal Engine projects. As a result of caching of precompiled headers, ReSharper C++ now indexes your code base up to twice as fast as before.

This experimental performance boost is currently available for Visual Studio 2022 only.

ReSharper C++ now supports Spec tests from the Unreal Engine automation testing framework. If you have a set of tests defined in the Define method after the DEFINE_SPEC macro or the BEGIN_DEFINE_SPEC/END_DEFINE_SPEC macros, ReSharper C++ will successfully discover them. In the Unit Test Sessions window, you can review the results of the tests and rerun failed tests, all tests, or specific tests.

The code completion list now includes Widgets metadata specifiers.

ReSharper C++ now properly handles Unreal Engine containers in Emplace calls, bringing improved search and navigation features, parameter name hints, and warnings about invalid arguments.

If you are interested in a stand-alone cross-platform IDE for Unreal Engine development, consider Rider. Unreal Engine support in Rider and ReSharper C++ is aligned and you can expect the same improvements in the Rider 2022.2 update.

C++ support

We've improved the readability of error tooltips by adding syntax highlighting. The error highlighting range also became more precise. For example, when getting an aggregate initialization warning, you can now tell at a glance exactly which subobject caused an initialization failure.

Parameter name hints now support make- and emplace-like function calls.

We’ve updated the bundled Clang-Tidy binary to Clang 14, adding new checks from the latest LLVM release.

ReSharper C++ 2022.2 also brings updates for Boost tests and introduces support for the Public Include Directories and All Header Files are Public project properties.

Take a look at What's New in ReSharper to learn about the other changes introduced in this release. For example, you can now remove temporary files generated by ReSharper while it is working on your code (ReSharper | Options | Environment | Disk Cleanup).

ReSharper C++ 2022.1

Unreal Engine

ReSharper C++ 2022.1 brings a brand new way to quickly consult the Unreal Engine documentation about the details of a class, symbol, or function. You can now click Read more in the Quick Documentation pop-up (Ctrl+Shift+F1) to open the corresponding page in your browser.

The Rename refactoring now handles the Unreal Engine interface classes better. When renaming interfaces, both the U and I classes will be renamed accordingly.

ReSharper C++ can now substitute the parameter names when you generate a member function signature from the Unreal Engine delegate.

You can now also generate such functions when the ThisClass typedef is used.

Here is a short overview of the most important Unreal-related fixes delivered in this version:

  • The Unreal Engine 5 built-in preprocessor macros are now supported in the .Build.cs and .Target.cs files.
  • ReSharper no longer suggests the recent C# features that are not applicable in the .Build.cs and .Target.cs files on Unreal Engine 4.
  • ReSharper C++ now reads the list of valid reflection specifiers directly from the version of Unreal Engine which is currently in use, so it only offers you applicable items in code completion and displays up-to-date documentation.
  • There are no more issues caused by the DOREPLIFETIME_WITH_PARAMS_FAST and MARK_PROPERTY_DIRTY_FROM_NAME push model macros – ReSharper C++ now is aware of entities generated by the replication system, such as ENetFields_Private enum.

Unit Testing

The Unreal Engine testing framework is now supported. ReSharper C++ discovers Unreal Engine unit tests and adds the corresponding action indicators next to each test in the editor to run or debug the test or the whole test suite. In the Unit Test Sessions window, you can review the results of the tests, and rerun failed, all, or specific tests.

The new version of the Catch2 unit test framework brings significant changes – it’s now split into multiple headers and has a statically compiled library as its distribution model. It means you now have to include several headers, but the compilation time is improved. So if you’d like to check out the updated Catch2 unit test framework, ReSharper C++ 2022.1 has full support to help you with it.

ReSharper C++ 2022.1 also includes updates for the latest releases of GoogleTest and doctest, as well as various unit testing fixes.

C++ support

ReSharper C++ is now better at handling implicit constructor calls, allowing you to find usages and navigate to the called constructor in more cases, including the following:

  • standard (make_unique/make_shared) and Unreal-specific (MakeShared/MakeUnique) smart pointer creation functions.
  • emplace-like container methods.
  • static_cast and c-style cast expressions.

ReSharper C++ now also shows you an overloading warning when an emplace-like function is called with incorrect arguments.

ReSharper C++ 2022.1 improves the multiline generation of boilerplate code for aggregate initialization using C++20 designated initializers. You can now invoke completion on the next line if you’d like to see each initializer on a new line.

Formatting

ReSharper C++ now treats the C++20 requires-expressions correctly, allowing you to configure spaces formatting via the Around ‘->’ in trailing return types option.

Use the new Line feed at the end of file option to control adding or removing a blank line from the end of files.

Take a look at What's New in ReSharper to learn about the other changes introduced in this release. For example, you can now autodetect syntax style settings for C# files.