1 ====================================================
2 Extra Clang Tools |release| |ReleaseNotesTitle|
3 ====================================================
9 Written by the `LLVM Team <https://llvm.org/>`_
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>`_.
21 This document contains the release notes for the Extra Clang Tools, part of the
22 Clang release |release|. Here we describe the status of the Extra Clang Tools in
23 some detail, including major improvements from the previous release and new
24 feature work. All LLVM releases may be downloaded from the `LLVM releases web
25 site <https://llvm.org/releases/>`_.
27 For more information about Clang or LLVM, including information about
28 the latest release, please see the `Clang Web Site <https://clang.llvm.org>`_ or
29 the `LLVM Web Site <https://llvm.org>`_.
31 Note that if you are reading this file from a Git checkout or the
32 main Clang web page, this document applies to the *next* release, not
33 the current one. To see the release notes for a specific release, please
34 see the `releases page <https://llvm.org/releases/>`_.
36 What's New in Extra Clang Tools |release|?
37 ==========================================
39 Some of the major new features and improvements to Extra Clang Tools are listed
40 here. Generic improvements to Extra Clang Tools as a whole or to its underlying
41 infrastructure are described first, followed by tool-specific sections.
48 Improvements to clangd
49 ----------------------
51 - Introduced exmperimental support for C++20 Modules. The experimental support can
52 be enabled by `-experimental-modules-support` option. It is in an early development
53 stage and may not perform efficiently in real-world scenarios.
76 - The tweak for turning unscoped into scoped enums now removes redundant prefixes
91 - Added a boolean option `AnalyzeAngledIncludes` to `Includes` config section,
92 which allows to enable unused includes detection for all angled ("system") headers.
93 At this moment umbrella headers are not supported, so enabling this option
94 may result in false-positives.
96 Improvements to clang-doc
97 -------------------------
99 Improvements to clang-query
100 ---------------------------
102 - Added the `file` command to dynamically load a list of commands and matchers
103 from an external file, allowing the cost of reading the compilation database
104 and building the AST to be imposed just once for faster prototyping.
106 - Removed support for ``enable output srcloc``. Fixes #GH82591
108 Improvements to clang-rename
109 ----------------------------
111 The improvements are...
113 Improvements to clang-tidy
114 --------------------------
116 - Improved :program:`run-clang-tidy.py` script. Added argument `-source-filter`
117 to filter source files from the compilation database, via a RegEx. In a
118 similar fashion to what `-header-filter` does for header files.
119 Added progress indicator with a number of processed files and the runtime of
120 each invocation after completion.
122 - Improved :program:`check_clang_tidy.py` script. Added argument `-export-fixes`
123 to aid in clang-tidy and test development.
125 - Fixed bug where big values for unsigned check options overflowed into negative values
126 when being printed with `--dump-config`.
128 - Fixed `--verify-config` option not properly parsing checks when using the
129 literal operator in the `.clang-tidy` config.
131 - Added argument `--exclude-header-filter` and config option `ExcludeHeaderFilterRegex`
132 to exclude headers from analysis via a RegEx.
134 - Added argument `--allow-no-checks` to suppress "no checks enabled" error
135 when disabling all of the checks by `--checks='-*'`.
140 - New :doc:`boost-use-ranges
141 <clang-tidy/checks/boost/use-ranges>` check.
143 Detects calls to standard library iterator algorithms that could be replaced
144 with a Boost ranges version instead.
146 - New :doc:`bugprone-crtp-constructor-accessibility
147 <clang-tidy/checks/bugprone/crtp-constructor-accessibility>` check.
149 Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP
150 can be constructed outside itself and the derived class.
152 - New :doc:`bugprone-pointer-arithmetic-on-polymorphic-object
153 <clang-tidy/checks/bugprone/pointer-arithmetic-on-polymorphic-object>` check.
155 Finds pointer arithmetic performed on classes that contain a virtual function.
157 - New :doc:`bugprone-return-const-ref-from-parameter
158 <clang-tidy/checks/bugprone/return-const-ref-from-parameter>` check.
160 Detects return statements that return a constant reference parameter as constant
161 reference. This may cause use-after-free errors if the caller uses xvalues as
164 - New :doc:`bugprone-suspicious-stringview-data-usage
165 <clang-tidy/checks/bugprone/suspicious-stringview-data-usage>` check.
167 Identifies suspicious usages of ``std::string_view::data()`` that could lead
168 to reading out-of-bounds data due to inadequate or incorrect string null
171 - New :doc:`misc-use-internal-linkage
172 <clang-tidy/checks/misc/use-internal-linkage>` check.
174 Detects variables and functions that can be marked as static or moved into
175 an anonymous namespace to enforce internal linkage.
177 - New :doc:`modernize-min-max-use-initializer-list
178 <clang-tidy/checks/modernize/min-max-use-initializer-list>` check.
180 Replaces nested ``std::min`` and ``std::max`` calls with an initializer list
183 - New :doc:`modernize-use-designated-initializers
184 <clang-tidy/checks/modernize/use-designated-initializers>` check.
186 Finds initializer lists for aggregate types that could be
187 written as designated initializers instead.
189 - New :doc:`modernize-use-ranges
190 <clang-tidy/checks/modernize/use-ranges>` check.
192 Detects calls to standard library iterator algorithms that could be replaced
193 with a ranges version instead.
195 - New :doc:`modernize-use-std-format
196 <clang-tidy/checks/modernize/use-std-format>` check.
198 Converts calls to ``absl::StrFormat``, or other functions via
199 configuration options, to C++20's ``std::format``, or another function
200 via a configuration option, modifying the format string appropriately and
201 removing now-unnecessary calls to ``std::string::c_str()`` and
202 ``std::string::data()``.
204 - New :doc:`readability-enum-initial-value
205 <clang-tidy/checks/readability/enum-initial-value>` check.
207 Enforces consistent style for enumerators' initialization, covering three
208 styles: none, first only, or all initialized explicitly.
210 - New :doc:`readability-math-missing-parentheses
211 <clang-tidy/checks/readability/math-missing-parentheses>` check.
213 Check for missing parentheses in mathematical expressions that involve
214 operators of different priorities.
216 - New :doc:`readability-use-std-min-max
217 <clang-tidy/checks/readability/use-std-min-max>` check.
219 Replaces certain conditional statements with equivalent calls to
220 ``std::min`` or ``std::max``.
225 - New alias :doc:`cert-ctr56-cpp <clang-tidy/checks/cert/ctr56-cpp>` to
226 :doc:`bugprone-pointer-arithmetic-on-polymorphic-object
227 <clang-tidy/checks/bugprone/pointer-arithmetic-on-polymorphic-object>`
230 - New alias :doc:`cert-int09-c <clang-tidy/checks/cert/int09-c>` to
231 :doc:`readability-enum-initial-value <clang-tidy/checks/readability/enum-initial-value>`
234 Changes in existing checks
235 ^^^^^^^^^^^^^^^^^^^^^^^^^^
237 - Improved :doc:`bugprone-assert-side-effect
238 <clang-tidy/checks/bugprone/assert-side-effect>` check by detecting side
239 effect from calling a method with non-const reference parameters.
241 - Improved :doc:`bugprone-assignment-in-if-condition
242 <clang-tidy/checks/bugprone/assignment-in-if-condition>` check by ignoring
243 assignments in the C++20 ``requires`` clause.
245 - Improved :doc:`bugprone-casting-through-void
246 <clang-tidy/checks/bugprone/casting-through-void>` check by ignoring casts
247 where source is already a ``void``` pointer, making middle ``void`` pointer
250 - Improved :doc:`bugprone-exception-escape
251 <clang-tidy/checks/bugprone/exception-escape>` check to correctly detect exception
252 handler of type ``CV void *`` as catching all ``CV`` compatible pointer types.
254 - Improved :doc:`bugprone-forwarding-reference-overload
255 <clang-tidy/checks/bugprone/forwarding-reference-overload>`
256 check to ignore deleted constructors which won't hide other overloads.
258 - Improved :doc:`bugprone-implicit-widening-of-multiplication-result
259 <clang-tidy/checks/bugprone/implicit-widening-of-multiplication-result>` check
260 by adding an option to ignore constant expressions of signed integer types
261 that fit in the source expression type.
263 - Improved :doc:`bugprone-inc-dec-in-conditions
264 <clang-tidy/checks/bugprone/inc-dec-in-conditions>` check to ignore code
265 within unevaluated contexts, such as ``decltype``.
267 - Improved :doc:`bugprone-lambda-function-name<clang-tidy/checks/bugprone/lambda-function-name>`
268 check by ignoring ``__func__`` macro in lambda captures, initializers of
269 default parameters and nested function declarations.
271 - Improved :doc:`bugprone-multi-level-implicit-pointer-conversion
272 <clang-tidy/checks/bugprone/multi-level-implicit-pointer-conversion>` check
273 by ignoring implicit pointer conversions that are part of a cast expression.
275 - Improved :doc:`bugprone-non-zero-enum-to-bool-conversion
276 <clang-tidy/checks/bugprone/non-zero-enum-to-bool-conversion>` check by
277 eliminating false positives resulting from direct usage of bitwise operators
280 - Improved :doc:`bugprone-optional-value-conversion
281 <clang-tidy/checks/bugprone/optional-value-conversion>` check by eliminating
282 false positives resulting from use of optionals in unevaluated context.
284 - Improved :doc:`bugprone-sizeof-expression
285 <clang-tidy/checks/bugprone/sizeof-expression>` check by clarifying the
286 diagnostics, eliminating some false positives and adding a new
287 (off-by-default) option `WarnOnSizeOfPointer` that reports all
288 ``sizeof(pointer)`` expressions (except for a few that are idiomatic).
290 - Improved :doc:`bugprone-suspicious-include
291 <clang-tidy/checks/bugprone/suspicious-include>` check by replacing the local
292 options `HeaderFileExtensions` and `ImplementationFileExtensions` by the
293 global options of the same name.
295 - Improved :doc:`bugprone-too-small-loop-variable
296 <clang-tidy/checks/bugprone/too-small-loop-variable>` check by incorporating
297 better support for ``const`` loop boundaries.
299 - Improved :doc:`bugprone-unused-local-non-trivial-variable
300 <clang-tidy/checks/bugprone/unused-local-non-trivial-variable>` check by
301 ignoring local variable with ``[maybe_unused]`` attribute.
303 - Improved :doc:`bugprone-unused-return-value
304 <clang-tidy/checks/bugprone/unused-return-value>` check by updating the
305 parameter `CheckedFunctions` to support regexp, avoiding false positive for
306 function with the same prefix as the default argument, e.g. ``std::unique_ptr``
307 and ``std::unique``, avoiding false positive for assignment operator overloading.
309 - Improved :doc:`bugprone-use-after-move
310 <clang-tidy/checks/bugprone/use-after-move>` check to also handle
311 calls to ``std::forward``. Fixed sequencing of designated initializers. Fixed
312 sequencing of callees: In C++17 and later, the callee of a function is guaranteed
313 to be sequenced before the arguments, so don't warn if the use happens in the
314 callee and the move happens in one of the arguments.
316 - Improved :doc:`cppcoreguidelines-avoid-non-const-global-variables
317 <clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables>` check
318 with a new option `AllowInternalLinkage` to disable the warning for variables
319 with internal linkage.
321 - Improved :doc:`cppcoreguidelines-macro-usage
322 <clang-tidy/checks/cppcoreguidelines/macro-usage>` check by ignoring macro with
323 hash preprocessing token.
325 - Improved :doc:`cppcoreguidelines-missing-std-forward
326 <clang-tidy/checks/cppcoreguidelines/missing-std-forward>` check by no longer
327 giving false positives for deleted functions, by fixing false negatives when only
328 a few parameters are forwarded and by ignoring parameters without a name (unused
331 - Improved :doc:`cppcoreguidelines-owning-memory
332 <clang-tidy/checks/cppcoreguidelines/owning-memory>` check to properly handle
333 return type in lambdas and in nested functions.
335 - Improved :doc:`cppcoreguidelines-prefer-member-initializer
336 <clang-tidy/checks/cppcoreguidelines/prefer-member-initializer>` check
337 by removing enforcement of rule `C.48
338 <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c48-prefer-in-class-initializers-to-member-initializers-in-constructors-for-constant-initializers>`_,
339 which was deprecated since :program:`clang-tidy` 17. This rule is now covered
340 by :doc:`cppcoreguidelines-use-default-member-init
341 <clang-tidy/checks/cppcoreguidelines/use-default-member-init>`. Fixed
342 incorrect hints when using list-initialization.
344 - Improved :doc:`cppcoreguidelines-special-member-functions
345 <clang-tidy/checks/cppcoreguidelines/special-member-functions>` check with a
346 new option `AllowImplicitlyDeletedCopyOrMove`, which removes the requirement
347 for explicit copy or move special member functions when they are already
350 - Improved :doc:`google-build-namespaces
351 <clang-tidy/checks/google/build-namespaces>` check by replacing the local
352 option `HeaderFileExtensions` by the global option of the same name.
354 - Improved :doc:`google-explicit-constructor
355 <clang-tidy/checks/google/explicit-constructor>` check to better handle
356 C++20 `explicit(bool)`.
358 - Improved :doc:`google-global-names-in-headers
359 <clang-tidy/checks/google/global-names-in-headers>` check by replacing the local
360 option `HeaderFileExtensions` by the global option of the same name.
362 - Improved :doc:`google-runtime-int <clang-tidy/checks/google/runtime-int>`
363 check performance through optimizations.
365 - Improved :doc:`hicpp-signed-bitwise <clang-tidy/checks/hicpp/signed-bitwise>`
366 check by ignoring false positives involving positive integer literals behind
367 implicit casts when `IgnorePositiveIntegerLiterals` is enabled.
369 - Improved :doc:`hicpp-ignored-remove-result <clang-tidy/checks/hicpp/ignored-remove-result>`
370 check by ignoring other functions with same prefixes as the target specific
373 - Improved :doc:`linuxkernel-must-check-errs
374 <clang-tidy/checks/linuxkernel/must-check-errs>` check documentation to
375 consistently use the check's proper name.
377 - Improved :doc:`llvm-header-guard
378 <clang-tidy/checks/llvm/header-guard>` check by replacing the local
379 option `HeaderFileExtensions` by the global option of the same name.
381 - Improved :doc:`misc-const-correctness
382 <clang-tidy/checks/misc/const-correctness>` check by avoiding infinite recursion
383 for recursive functions with forwarding reference parameters and reference
384 variables which refer to themselves. Also adapted the check to work with
387 - Improved :doc:`misc-definitions-in-headers
388 <clang-tidy/checks/misc/definitions-in-headers>` check by replacing the local
389 option `HeaderFileExtensions` by the global option of the same name.
390 Additionally, the option `UseHeaderFileExtensions` is removed, so that the
391 check uses the `HeaderFileExtensions` option unconditionally.
393 - Improved :doc:`misc-header-include-cycle
394 <clang-tidy/checks/misc/header-include-cycle>` check by avoiding crash for self
397 - Improved :doc:`misc-unused-using-decls
398 <clang-tidy/checks/misc/unused-using-decls>` check by replacing the local
399 option `HeaderFileExtensions` by the global option of the same name.
401 - Improved :doc:`misc-use-anonymous-namespace
402 <clang-tidy/checks/misc/use-anonymous-namespace>` check by replacing the local
403 option `HeaderFileExtensions` by the global option of the same name.
405 - Improved :doc:`modernize-avoid-c-arrays
406 <clang-tidy/checks/modernize/avoid-c-arrays>` check by introducing the new
407 `AllowStringArrays` option, enabling the exclusion of array types with deduced
408 length initialized from string literals.
410 - Improved :doc:`modernize-loop-convert
411 <clang-tidy/checks/modernize/loop-convert>` check by ensuring that fix-its
412 don't remove parentheses used in ``sizeof`` calls when they have array index
413 accesses as arguments.
415 - Improved :doc:`modernize-use-constraints
416 <clang-tidy/checks/modernize/use-constraints>` check by fixing a crash that
417 occurred in some scenarios and excluding system headers from analysis.
419 - Improved :doc:`modernize-use-nullptr
420 <clang-tidy/checks/modernize/use-nullptr>` check to include support for C23,
421 which also has introduced the ``nullptr`` keyword.
423 - Improved :doc:`modernize-use-override
424 <clang-tidy/checks/modernize/use-override>` check to also remove any trailing
425 whitespace when deleting the ``virtual`` keyword.
427 - Improved :doc:`modernize-use-starts-ends-with
428 <clang-tidy/checks/modernize/use-starts-ends-with>` check to also handle
429 calls to ``compare`` method.
431 - Improved :doc:`modernize-use-std-print
432 <clang-tidy/checks/modernize/use-std-print>` check to not crash if the
433 format string parameter of the function to be replaced is not of the
436 - Improved :doc:`modernize-use-using <clang-tidy/checks/modernize/use-using>`
437 check by adding support for detection of typedefs declared on function level.
439 - Improved :doc:`performance-inefficient-vector-operation
440 <clang-tidy/checks/performance/inefficient-vector-operation>` fixing false
441 negatives caused by different variable definition type and variable initial
442 value type in loop initialization expression.
444 - Improved :doc:`performance-move-const-arg
445 <clang-tidy/checks/performance/move-const-arg>` check by ignoring
446 ``std::move()`` calls when their target is used as an rvalue.
448 - Improved :doc:`performance-unnecessary-copy-initialization
449 <clang-tidy/checks/performance/unnecessary-copy-initialization>` check by
450 detecting more cases of constant access. In particular, pointers can be
451 analyzed, so the check now handles the common patterns
452 `const auto e = (*vector_ptr)[i]` and `const auto e = vector_ptr->at(i);`.
453 Calls to mutable function where there exists a `const` overload are also
454 handled. Fix crash in the case of a non-member operator call.
456 - Improved :doc:`performance-unnecessary-value-param
457 <clang-tidy/checks/performance/unnecessary-value-param>` check
458 detecting more cases for template functions including lambdas with ``auto``.
459 E.g., ``std::sort(a.begin(), a.end(), [](auto x, auto y) { return a > b; });``
460 will be detected for expensive to copy types. Fixed false positives for
461 dependent call expressions.
463 - Improved :doc:`readability-avoid-return-with-void-value
464 <clang-tidy/checks/readability/avoid-return-with-void-value>` check by adding
467 - Improved :doc:`readability-const-return-type
468 <clang-tidy/checks/readability/const-return-type>` check to eliminate false
469 positives when returning types with const not at the top level.
471 - Improved :doc:`readability-container-size-empty
472 <clang-tidy/checks/readability/container-size-empty>` check to prevent false
473 positives when utilizing ``size`` or ``length`` methods that accept parameter.
474 Fixed crash when facing template user defined literals.
476 - Improved :doc:`readability-duplicate-include
477 <clang-tidy/checks/readability/duplicate-include>` check by excluding include
478 directives that form the filename using macro.
480 - Improved :doc:`readability-else-after-return
481 <clang-tidy/checks/readability/else-after-return>` check to ignore
482 `if consteval` statements, for which the `else` branch must not be removed.
484 - Improved :doc:`readability-identifier-naming
485 <clang-tidy/checks/readability/identifier-naming>` check in `GetConfigPerFile`
486 mode by resolving symbolic links to header files. Fixed handling of Hungarian
487 Prefix when configured to `LowerCase`. Added support for renaming designated
488 initializers. Added support for renaming macro arguments. Fixed renaming
489 conflicts arising from out-of-line member function template definitions.
491 - Improved :doc:`readability-implicit-bool-conversion
492 <clang-tidy/checks/readability/implicit-bool-conversion>` check to provide
493 valid fix suggestions for ``static_cast`` without a preceding space and
494 fixed problem with duplicate parentheses in double implicit casts. Corrected
495 the fix suggestions for C23 and later by using C-style casts instead of
496 ``static_cast``. Fixed false positives in C++20 spaceship operator by ignoring
497 casts in implicit and defaulted functions.
499 - Improved :doc:`readability-redundant-inline-specifier
500 <clang-tidy/checks/readability/redundant-inline-specifier>` check to properly
501 emit warnings for static data member with an in-class initializer.
503 - Improved :doc:`readability-redundant-member-init
504 <clang-tidy/checks/readability/redundant-member-init>` check to avoid
505 false-positives when type of the member does not match the type of the
508 - Improved :doc:`readability-static-accessed-through-instance
509 <clang-tidy/checks/readability/static-accessed-through-instance>` check to
510 support calls to overloaded operators as base expression and provide fixes to
511 expressions with side-effects.
513 - Improved :doc:`readability-simplify-boolean-expr
514 <clang-tidy/checks/readability/simplify-boolean-expr>` check to avoid to emit
515 warning for macro when IgnoreMacro option is enabled and improve messages
516 when auto-fix does not work.
518 - Improved :doc:`readability-static-definition-in-anonymous-namespace
519 <clang-tidy/checks/readability/static-definition-in-anonymous-namespace>`
520 check by resolving fix-it overlaps in template code by disregarding implicit
523 - Improved :doc:`readability-string-compare
524 <clang-tidy/checks/readability/string-compare>` check to also detect
525 usages of ``std::string_view::compare``. Added a `StringLikeClasses` option
526 to detect usages of ``compare`` method in custom string-like classes.
531 - Removed `cert-dcl21-cpp`, which was deprecated since :program:`clang-tidy` 17,
532 since the rule DCL21-CPP has been removed from the CERT guidelines.
537 - Fixed incorrect formatting in :program:`clang-apply-replacements` when no
538 `--format` option is specified. Now :program:`clang-apply-replacements`
539 applies formatting only with the option.
541 Improvements to include-fixer
542 -----------------------------
544 The improvements are...
546 Improvements to clang-include-fixer
547 -----------------------------------
549 The improvements are...
551 Improvements to modularize
552 --------------------------
554 The improvements are...
556 Improvements to pp-trace
557 ------------------------
559 Clang-tidy Visual Studio plugin
560 -------------------------------