1==================================================== 2Extra Clang Tools |release| |ReleaseNotesTitle| 3==================================================== 4 5.. contents:: 6 :local: 7 :depth: 3 8 9Written by the `LLVM Team <https://llvm.org/>`_ 10 11Introduction 12============ 13 14This document contains the release notes for the Extra Clang Tools, part of the 15Clang release |release|. Here we describe the status of the Extra Clang Tools in 16some detail, including major improvements from the previous release and new 17feature work. All LLVM releases may be downloaded from the `LLVM releases web 18site <https://llvm.org/releases/>`_. 19 20For more information about Clang or LLVM, including information about 21the latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or 22the `LLVM Web Site <https://llvm.org>`_. 23 24Note that if you are reading this file from a Git checkout or the 25main Clang web page, this document applies to the *next* release, not 26the current one. To see the release notes for a specific release, please 27see the `releases page <https://llvm.org/releases/>`_. 28 29What's New in Extra Clang Tools |release|? 30========================================== 31 32Some of the major new features and improvements to Extra Clang Tools are listed 33here. Generic improvements to Extra Clang Tools as a whole or to its underlying 34infrastructure are described first, followed by tool-specific sections. 35 36Major New Features 37------------------ 38 39... 40 41Improvements to clangd 42---------------------- 43 44Inlay hints 45^^^^^^^^^^^ 46 47- Provide hints for: 48 - Lambda return types. 49 - Forwarding functions using the underlying function call. 50- Support for standard LSP 3.17 inlay hints protocol. 51- Designator inlay hints are enabled by default. 52 53Diagnostics 54^^^^^^^^^^^ 55 56- Improved Fix-its of some clang-tidy checks when applied with clangd. 57- Clangd now produces diagnostics for forwarding functions like make_unique. 58- Include cleaner analysis can be disabled with the ``Diagnostics.Includes.IgnoreHeader`` config option. 59- Include cleaner doesn’t diagnose exporting headers. 60- clang-tidy and include cleaner diagnostics have links to their documentation. 61 62Semantic Highlighting 63^^^^^^^^^^^^^^^^^^^^^ 64 65- Semantic highlighting works for tokens that span multiple lines. 66- Mutable reference parameters in function calls receive ``usedAsMutableReference`` modifier. 67 68Hover 69^^^^^ 70 71- Hover displays desugared types by default now. 72 73Code completion 74^^^^^^^^^^^^^^^ 75 76- Improved ranking/filtering for ObjC method selectors. 77- Support for C++20 concepts and requires expressions. 78 79Signature help 80^^^^^^^^^^^^^^ 81 82- Signature help for function pointers. 83- Provides hints using underlying functions in forwarded calls. 84 85Cross-references 86^^^^^^^^^^^^^^^^ 87 88Code Actions 89^^^^^^^^^^^^ 90 91- New code action to generate ObjC initializers. 92- New code action to generate move/copy constructors/assignments. 93- Extract to function works for methods in addition to free functions. 94- Related diagnostics are attached to code actions response, if any. 95- Extract variable works in C and ObjC files. 96- Fix to define outline when the parameter has a braced initializer. 97 98Miscellaneous 99^^^^^^^^^^^^^ 100 101- Include fixer supports symbols inside macro arguments. 102- Dependent autos are now deduced when there’s a single instantiation. 103- Support for symbols exported with using declarations in all features. 104- Fixed background-indexing priority for M1 chips. 105- Indexing for standard library symbols. 106- ObjC framework includes are spelled properly during include insertion operations. 107 108Improvements to clang-doc 109------------------------- 110 111The improvements are... 112 113Improvements to clang-query 114--------------------------- 115 116The improvements are... 117 118Improvements to clang-rename 119---------------------------- 120 121The improvements are... 122 123Improvements to clang-tidy 124-------------------------- 125 126- Added trace code to help narrow down any checks and the relevant source code 127 that result in crashes. 128 129- Clang-tidy now consideres newlines as separators of single elements in the `Checks` section in 130 `.clang-tidy` configuration files. Where previously a comma had to be used to distinguish elements in 131 this list from each other, newline characters now also work as separators in the parsed YAML. That 132 means it is advised to use YAML's block style initiated by the pipe character `|` for the `Checks` 133 section in order to benefit from the easier syntax that works without commas. 134 135- Fixed a regression introduced in clang-tidy 14.0.0, which prevented NOLINTs 136 from suppressing diagnostics associated with macro arguments. This fixes 137 `Issue 55134 <https://github.com/llvm/llvm-project/issues/55134>`_. 138 139- Added an option -verify-config which will check the config file to ensure each 140 `Checks` and `CheckOptions` entries are recognised. 141 142- .clang-tidy files can now use the more natural dictionary syntax for specifying `CheckOptions`. 143 144New checks 145^^^^^^^^^^ 146 147- New :doc:`bugprone-shared-ptr-array-mismatch <clang-tidy/checks/bugprone/shared-ptr-array-mismatch>` check. 148 149 Finds initializations of C++ shared pointers to non-array type that are initialized with an array. 150 151- New :doc:`bugprone-unchecked-optional-access 152 <clang-tidy/checks/bugprone/unchecked-optional-access>` check. 153 154 Warns when the code is unwrapping a `std::optional<T>`, `absl::optional<T>`, 155 or `base::Optional<T>` object without assuring that it contains a value. 156 157- New :doc:`misc-confusable-identifiers <clang-tidy/checks/misc/confusable-identifiers>` check. 158 159 Detects confusable Unicode identifiers. 160 161- New :doc:`bugprone-assignment-in-if-condition 162 <clang-tidy/checks/bugprone/assignment-in-if-condition>` check. 163 164 Warns when there is an assignment within an if statement condition expression. 165 166- New :doc:`misc-const-correctness 167 <clang-tidy/checks/misc/const-correctness>` check. 168 169 Detects unmodified local variables and suggest adding ``const`` if the transformation is possible. 170 171- New :doc:`modernize-macro-to-enum 172 <clang-tidy/checks/modernize/macro-to-enum>` check. 173 174 Replaces groups of adjacent macros with an unscoped anonymous enum. 175 176- New :doc:`portability-std-allocator-const <clang-tidy/checks/portability/std-allocator-const>` check. 177 178 Report use of ``std::vector<const T>`` (and similar containers of const 179 elements). These are not allowed in standard C++ due to undefined 180 ``std::allocator<const T>``. They do not compile with libstdc++ or MSVC. 181 Future libc++ will remove the extension (`D120996 182 <https://reviews.llvm.org/D120996>`). 183 184New check aliases 185^^^^^^^^^^^^^^^^^ 186 187- New alias :doc:`cppcoreguidelines-macro-to-enum 188 <clang-tidy/checks/cppcoreguidelines/macro-to-enum>` to :doc:`modernize-macro-to-enum 189 <clang-tidy/checks/modernize/macro-to-enum>` was added. 190 191Changes in existing checks 192^^^^^^^^^^^^^^^^^^^^^^^^^^ 193 194- Fixed nonsensical suggestion of :doc:`altera-struct-pack-align 195 <clang-tidy/checks/altera/struct-pack-align>` check for empty structs. 196 197- Fixed a false positive in :doc:`bugprone-branch-clone 198 <clang-tidy/checks/bugprone/branch-clone>` when the branches 199 involve unknown expressions. 200 201- Fixed some false positives in :doc:`bugprone-infinite-loop 202 <clang-tidy/checks/bugprone/infinite-loop>` involving dependent expressions. 203 204- Fixed a crash in :doc:`bugprone-sizeof-expression 205 <clang-tidy/checks/bugprone/sizeof-expression>` when `sizeof(...)` is 206 compared against a `__int128_t`. 207 208- Fixed bugs in :doc:`bugprone-use-after-move 209 <clang-tidy/checks/bugprone/use-after-move>`: 210 211 - Treat a move in a lambda capture as happening in the function that defines 212 the lambda, not within the body of the lambda (as we were previously doing 213 erroneously). 214 215 - Don't emit an erroneous warning on self-moves. 216 217- Improved :doc:`cert-dcl58-cpp 218 <clang-tidy/checks/cert/dcl58-cpp>` check. 219 220 The check now detects explicit template specializations that are handled specially. 221 222- Made :doc:`cert-oop57-cpp <clang-tidy/checks/cert/oop57-cpp>` more sensitive 223 by checking for an arbitrary expression in the second argument of ``memset``. 224 225- Made the fix-it of :doc:`cppcoreguidelines-init-variables 226 <clang-tidy/checks/cppcoreguidelines/init-variables>` use ``false`` to initialize 227 boolean variables. 228 229- Improved :doc:`cppcoreguidelines-prefer-member-initializer 230 <clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check. 231 232 Fixed an issue when there was already an initializer in the constructor and 233 the check would try to create another initializer for the same member. 234 235- Fixed a false positive in :doc:`cppcoreguidelines-virtual-class-destructor 236 <clang-tidy/checks/cppcoreguidelines/virtual-class-destructor>` involving 237 ``final`` classes. The check will not diagnose classes marked ``final``, since 238 those cannot be used as base classes, consequently, they can not violate the 239 rule. 240 241- Fixed a crash in :doc:`llvmlibc-callee-namespace 242 <clang-tidy/checks/llvmlibc/callee-namespace>` when executing for C++ code 243 that contain calls to advanced constructs, e.g. overloaded operators. 244 245- Fixed false positives in :doc:`misc-redundant-expression 246 <clang-tidy/checks/misc/redundant-expression>`: 247 248 - Fixed a false positive involving overloaded comparison operators. 249 250 - Fixed a false positive involving assignments in 251 conditions. This fixes `Issue 35853 <https://github.com/llvm/llvm-project/issues/35853>`_. 252 253- Fixed a false positive in :doc:`misc-unused-parameters 254 <clang-tidy/checks/misc/unused-parameters>` 255 where invalid parameters were implicitly being treated as being unused. 256 This fixes `Issue 56152 <https://github.com/llvm/llvm-project/issues/56152>`_. 257 258- Fixed false positives in :doc:`misc-unused-using-decls 259 <clang-tidy/checks/misc/unused-using-decls>` where `using` statements bringing 260 operators into the scope where incorrectly marked as unused. 261 This fixes `issue 55095 <https://github.com/llvm/llvm-project/issues/55095>`_. 262 263- Fixed a false positive in :doc:`modernize-deprecated-headers 264 <clang-tidy/checks/modernize/deprecated-headers>` involving including 265 C header files from C++ files wrapped by ``extern "C" { ... }`` blocks. 266 Such includes will be ignored by now. 267 By default now it doesn't warn for including deprecated headers from header 268 files, since that header file might be used from C source files. By passing 269 the ``CheckHeaderFile=true`` option if header files of the project only 270 included by C++ source files. 271 272- Improved :doc:`performance-inefficient-vector-operation 273 <clang-tidy/checks/performance/inefficient-vector-operation>` to work when 274 the vector is a member of a structure. 275 276- Fixed a crash in :doc:`performance-unnecessary-value-param 277 <clang-tidy/checks/performance/unnecessary-value-param>` when the specialization 278 template has an unnecessary value parameter. Removed the fix for a template. 279 280- Fixed a crash in :doc:`readability-const-return-type 281 <clang-tidy/checks/readability/const-return-type>` when a pure virtual function 282 overrided has a const return type. Removed the fix for a virtual function. 283 284- Skipped addition of extra parentheses around member accesses (``a.b``) in fix-it for 285 :doc:`readability-container-data-pointer <clang-tidy/checks/readability/container-data-pointer>`. 286 287- Fixed incorrect suggestions for :doc:`readability-container-size-empty 288 <clang-tidy/checks/readability/container-size-empty>` when smart pointers are involved. 289 290- Fixed a false positive in :doc:`readability-non-const-parameter 291 <clang-tidy/checks/readability/non-const-parameter>` when the parameter is 292 referenced by an lvalue. 293 294- Expanded :doc:`readability-simplify-boolean-expr 295 <clang-tidy/checks/readability/simplify-boolean-expr>` to simplify expressions 296 using DeMorgan's Theorem. 297 298Removed checks 299^^^^^^^^^^^^^^ 300 301Improvements to include-fixer 302----------------------------- 303 304The improvements are... 305 306Improvements to clang-include-fixer 307----------------------------------- 308 309The improvements are... 310 311Improvements to modularize 312-------------------------- 313 314The improvements are... 315 316Improvements to pp-trace 317------------------------ 318 319- Added `HashLoc` information to `InclusionDirective` callback output. 320 321Clang-tidy Visual Studio plugin 322------------------------------- 323