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