{"id":340363,"date":"2023-04-05T13:09:59","date_gmt":"2023-04-05T12:09:59","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=rscpp&#038;p=340363"},"modified":"2023-08-01T02:12:08","modified_gmt":"2023-08-01T01:12:08","slug":"resharper-cpp-2023-1","status":"publish","type":"rscpp","link":"https:\/\/blog.jetbrains.com\/zh-hans\/rscpp\/2023\/04\/05\/resharper-cpp-2023-1","title":{"rendered":"ReSharper C++ 2023.1: Call Tracking, Macro Expansion Preview, and Support for C++23 Features"},"content":{"rendered":"<p>We\u2019ve just released ReSharper C++ 2023.1!<\/p>\n<p>This update brings support for new C++20 and C++23 features as well as improvements for C++20 modules, Call tracking, macro substitution previews, context actions for refactorings, and file templates for Unreal Engine tests. To learn about all of the improvements in this release, check out our <a href=\"https:\/\/www.jetbrains.com\/resharper-cpp\/whatsnew\/\" target=\"_blank\" rel=\"noopener\">What&#8217;s New<\/a> page.<\/p>\n<p><a href=\"https:\/\/www.jetbrains.com\/resharper-cpp\/whatsnew\/\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/04\/Release_Preview_image_1280x600_ReSharperCPP-2x.png\" alt=\"ReSharper C++ 2023.1\" width=\"800\"><\/a><\/p>\n<p>Update to this version, or start a free 30-day trial today! The brand-new build is available on our website, and all our tools for Visual Studio can be downloaded via the <a href=\"https:\/\/www.jetbrains.com\/toolbox-app\" target=\"_blank\" rel=\"noopener\">Toolbox App<\/a>.<\/p>\n<p align=\"center\"><a class=\"jb-download-button\" href=\"https:\/\/www.jetbrains.com\/resharper-cpp\/download\/?utm_source=twitter&amp;utm_medium=blog_post&amp;utm_campaign=rscpp_release_2023_1\" target=\"_blank\" rel=\"noopener\"><i class=\"download-icon\"><\/i>DOWNLOAD RESHARPER C++<\/a><\/p>\n<p>Without further ado, let&#8217;s take a look at the key features in the new version:<\/p>\n<ul>\n<li><a href=\"#call_tracking\">Call tracking<\/a><\/li>\n<li><a href=\"#macro_substitution_preview\">Macro substitution preview<\/a><\/li>\n<li><a href=\"#updates_for_cpp20_modules\">Updates for C++20 modules<\/a><\/li>\n<li><a href=\"#support_for_cpp23_features\">Support for C++23 features<\/a><\/li>\n<li><a href=\"#unreal_engine\">Unreal Engine<\/a><\/li>\n<li><a href=\"#refactorings\">Refactorings<\/a><\/li>\n<li><a href=\"#code_analysis\">Code analysis<\/a><\/li>\n<li><a href=\"#other_changes\">Other changes<\/a><\/li>\n<\/ul>\n<h2 id=\"call_tracking\">Call tracking<\/h2>\n<p>ReSharper\u2019s <em>Call tracking<\/em> has finally come to ReSharper C++! You can now view and navigate through call chains in the hierarchy of incoming calls. Just place the caret at any function and select <em>Inspect | Incoming calls<\/em> from the context menu or press <code>Ctrl+Shift+Alt+A<\/code> to invoke it from the <em>Inspect This<\/em> menu.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/04\/rscpp_call_tracking_light.png\" alt=\"Call tracking\" width=\"600\"><\/p>\n<p>In the call tracking results window, you can double-click on the hierarchy entry to navigate to the corresponding call in the editor or expand any node to check out its incoming calls.<br \/>\nTracking outgoing calls is currently not supported.<\/p>\n<h2 id=\"macro_substitution_preview\">Macro substitution preview<\/h2>\n<p>When hovering over a macro, you can now see the macro expansion in the tooltip with full syntax highlighting and proper code formatting. You can still use the <em>Substitute macro call<\/em> context action to check out the macro expansion right in the code, but the instant preview makes working with macros easier.<br \/>\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/04\/macro_preview_tooltip.png\" alt=\"Macro substitution preview\" width=\"600\"><\/p>\n<p>Additionally, the <em>Quick Documentation<\/em> popup (<code>Ctrl+Shift+F1<\/code>) <a href=\"https:\/\/blog.jetbrains.com\/zh-hans\/rscpp\/2023\/01\/31\/resharper-cpp-2023-1-eap2#preview_of_macro_substitution\">allows<\/a> you to click on any entity from the substitution preview to check out its documentation.<\/p>\n<h2 id=\"updates_for_cpp20_modules\">Updates for C++20 modules<\/h2>\n<p>ReSharper C++ 2022.3 <a href=\"https:\/\/blog.jetbrains.com\/zh-hans\/rscpp\/2022\/11\/14\/cpp20-modules\">introduced<\/a> initial support for C++20 modules. In this update, we\u2019ve polished our implementation to handle more corner cases and better support real-world projects that use them. We\u2019ve also expanded the list of ReSharper C++ features that help you write modularized code:<\/p>\n<ul>\n<li><em>Find usages<\/em> now lets you find all locations where a given module is imported.<\/li>\n<li>The <em>Rename<\/em> refactoring helps you safely rename modules and module partitions, updating all the relevant declarations and imports in your code.<\/li>\n<li>The code formatter and <em>Rearrange code <\/em>now handle <code>export<\/code> blocks and exported entities.<\/li>\n<li>Code completion suggests the module-related keywords and names of known modules.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/modules_completion.png\" alt=\"Completion for C++20 modules\" width=\"600\"><\/p>\n<h2 id=\"support_for_cpp23_features\">Support for C++23 features<\/h2>\n<p>The ISO C++ Standards Committee has recently completed the technical work on C++23. With many C++23 features already available in the major compilers, ReSharper C++ 2023.1 is here to help you try out the following new language features:<\/p>\n<ul>\n<li>With <em>Deducing this<\/em> (<a href=\"http:\/\/wg21.link\/p0847\" target=\"_blank\" rel=\"noopener\">P0847<\/a>), you can now make the object parameter explicit with the <code>this<\/code> keyword, which simplifies the implementation of several C++ idioms.<\/li>\n<li><code>auto(x)<\/code> and <code>auto{x}<\/code> (<a href=\"http:\/\/wg21.link\/p0849\" target=\"_blank\" rel=\"noopener\">P0849<\/a>) allow you to make a copy of the argument as if it were passed as a function argument by value.<\/li>\n<li>Empty parentheses <code>()<\/code> in lambdas are now optional in many cases (<a href=\"http:\/\/wg21.link\/p1102\" target=\"_blank\" rel=\"noopener\">P1102<\/a>).<\/li>\n<li>Alias declarations are now allowed in init statements (<a href=\"http:\/\/wg21.link\/p2360\" target=\"_blank\" rel=\"noopener\">P2360<\/a>).<\/li>\n<li>Labels are now allowed at the end of compound statements (<a href=\"http:\/\/wg21.link\/p2324\" target=\"_blank\" rel=\"noopener\">P2324<\/a>).<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/04\/cpp23_deducing_this.png\" alt=\"Deducing this\" width=\"600\"><br \/>\nCheck out this <a href=\"https:\/\/blog.jetbrains.com\/zh-hans\/rscpp\/2023\/02\/03\/resharper-cpp-2023-1-eap3-call-tracking#cpp_support\">blog post<\/a> for more details about new C++23 features.<\/p>\n<h2 id=\"unreal_engine\">Unreal Engine<\/h2>\n<p>You can now quickly add a simple or a complex Unreal Engine test using the new built-in file templates. Just go to <em>Solution Explorer<\/em> and right-click on the preferred project folder to open the <em>Add<\/em> menu (or use <code>Ctrl+Alt+Insert<\/code>).<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/01\/test_template.png\" alt=\"Unreal Engine tests\" width=\"600\"><\/p>\n<p>Among other updates for Unreal Engine projects are mappings for shader source directories, a live template to add a new <code>UINTERFACE<\/code> class, and a completion item that lets you generate a lambda expression where a delegate, <code>TFunction<\/code>, or <code>TFunctionRef<\/code> argument is expected.<\/p>\n<div style=\"background-color: #f1f6fe; margin-bottom: 40px; padding: 15px; margin-right: 0%; font-size: 14px; line-height: 20px; text-align: justify;\"><em>If you\u2019re interested in a stand-alone cross-platform IDE for Unreal Engine development, consider <a href=\"https:\/\/www.jetbrains.com\/rider\/whatsnew\/#version-2023-1-game-development\" target=\"_blank\" rel=\"noopener\">Rider<\/a>. Unreal Engine support in Rider and ReSharper C++ is aligned, and you can expect the same improvements in the Rider 2023.1 update.<\/em><\/div>\n<h2 id=\"refactorings\">Refactorings<\/h2>\n<p>You can now access most of the refactorings easily from the <code>Alt+Enter<\/code> menu in addition to the dedicated <em>Refactor This<\/em> popup (<code>Ctrl+Shift+R<\/code>).<br \/>\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/01\/context_actions_ref.png\" alt=\"Extract method in the Alt+Enter menu\" width=\"600\"><\/p>\n<p>This release includes many bug fixes and <a href=\"https:\/\/blog.jetbrains.com\/zh-hans\/rscpp\/2023\/01\/19\/resharper-cpp-2023-1-eap#refactorings\">usability improvements<\/a> for the <em>Change signature<\/em> and <em>Extract method<\/em> refactorings, and also a new quick-fix to <a href=\"https:\/\/blog.jetbrains.com\/zh-hans\/rscpp\/2023\/01\/19\/resharper-cpp-2023-1-eap#create_from_usage\">create parameter<\/a> from an unresolved identifier.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/01\/create_parameter.png\" alt=\"Create parameter\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/01\/create_parameter.gif\"><\/p>\n<h2 id=\"code_analysis\">Code analysis<\/h2>\n<p>We\u2019ve introduced an inspection that flags function parameters of expensive-to-copy types that are passed by value, with a quick-fix to pass the parameter by <code>const<\/code> reference instead.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/01\/const_reference.png\" alt=\"Pass a parameter by const reference\" width=\"600\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/01\/const_reference.gif\"><\/p>\n<p>The following new code inspections warn you about potential code smells:<\/p>\n<ul>\n<li><em>Template parameter is never used.<\/em><\/li>\n<li><em>Typedef\/type alias is never used.<\/em><\/li>\n<li><em>Redundant base class initializer.<\/em><\/li>\n<li><em>Function result of type <\/em><em><code>HRESULT<\/code><\/em><em>\/<\/em><em><code>NTSTATUS<\/code><\/em><em> should be used.<\/em><\/li>\n<\/ul>\n<p>One more inspection lets you know when C++17 class template argument deduction fails to deduce the template arguments, allowing you to quickly add the required arguments with a fix.<\/p>\n<p>ReSharper C++ 2023.1 also includes many improvements for the compile-time evaluation engine, such as the evaluation of range-based <code>for<\/code> loops and better support for unions.<\/p>\n<h2 id=\"other_changes\">Other changes<\/h2>\n<p>ReSharper C++ now supports the <code>__VA_OPT__<\/code> macro, which was introduced in C++20 to help define variadic macros. This special functional macro expands to its arguments when the variable argument list is not empty and expands to nothing otherwise.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/03\/va_opt.png\" alt=\"__VA_OPT__\" width=\"600\"><\/p>\n<p>Other important changes include an option to sort <code>#includes<\/code> in path-order or alphabetically, a postfix template to quickly make a <code>const<\/code> reference with <code>std::as_const<\/code> or <code>AsConst<\/code>, and disabled auto-insertion of the closing <code>*\/<\/code> comment.<\/p>\n<p>Those are the highlights of this release! We&#8217;ve also addressed many quality and performance issues \u2013 check out the <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/RSCPP?q=Available%20in:%20%7B2023.1*%7D&amp;_gl=1*1lfread*_ga*MTkzODY1NTQwOS4xNjUyNDc1NDkx*_ga_9J976DJZ68*MTY4MDExODYxMC42MTQuMS4xNjgwMTE5MTY4LjUyLjAuMA..&amp;_ga=2.41043879.406998664.1679873443-1938655409.1652475491\" target=\"_blank\" rel=\"noopener\">full list of fixed issues<\/a> in our YouTrack. More changes are coming from the <a href=\"https:\/\/www.jetbrains.com\/resharper\/whatsnew\/\" target=\"_blank\" rel=\"noopener\">ReSharper platform<\/a>, like CSS support being disabled by default.<\/p>\n<p>If you have any feedback or questions, please don&#8217;t hesitate to reach out to us and report issues to <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/RSCPP\" target=\"_blank\" rel=\"noopener\">our tracker<\/a>.<\/p>\n<p align=\"center\"><a class=\"jb-download-button\" href=\"https:\/\/www.jetbrains.com\/resharper-cpp\/download\/?utm_source=twitter&amp;utm_medium=blog_post&amp;utm_campaign=rscpp_release_2023_1\" target=\"_blank\" rel=\"noopener\"><i class=\"download-icon\"><\/i>DOWNLOAD RESHARPER C++<\/a><\/p>\n<p><em>Your ReSharper C++ team<\/em><br \/>\nJetBrains<br \/>\nThe Drive to Develop<\/p>\n","protected":false},"author":1053,"featured_media":340636,"comment_status":"closed","ping_status":"closed","template":"","categories":[89,907],"tags":[7176,3606,6773,6670,2095],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rscpp\/340363"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rscpp"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/rscpp"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/1053"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=340363"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rscpp\/340363\/revisions"}],"predecessor-version":[{"id":377137,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/rscpp\/340363\/revisions\/377137"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/340636"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=340363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=340363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=340363"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=340363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}