Extra Clang Tools 22.0.0git (In-Progress) Release Notes¶
Written by the LLVM Team
Warning
These are in-progress notes for the upcoming Extra Clang Tools 22 release. Release notes for previous releases can be found on the Download Page.
Introduction¶
This document contains the release notes for the Extra Clang Tools, part of the Clang release 22.0.0git. Here we describe the status of the Extra Clang Tools in some detail, including major improvements from the previous release and new feature work. All LLVM releases may be downloaded from the LLVM releases web site.
For more information about Clang or LLVM, including information about the latest release, please see the Clang Web Site or the LLVM Web Site.
Note that if you are reading this file from a Git checkout or the main Clang web page, this document applies to the next release, not the current one. To see the release notes for a specific release, please see the releases page.
What’s New in Extra Clang Tools 22.0.0git?¶
Some of the major new features and improvements to Extra Clang Tools are listed here. Generic improvements to Extra Clang Tools as a whole or to its underlying infrastructure are described first, followed by tool-specific sections.
Major New Features¶
Potentially Breaking Changes¶
Deprecated the clang-tidy
zirconmodule. All checks have been moved to thefuchsiamodule instead. Thezirconmodule will be removed in the 24th release.Removed clang-tidy’s global options IgnoreMacros and StrictMode, which were documented as deprecated since clang-tidy-20. Users should use the check-specific options of the same name instead.
Renamed a few clang-tidy check options, as they were misspelled:
NamePrefixSuffixSilenceDissimilarityTreshold to NamePrefixSuffixSilenceDissimilarityThreshold in bugprone-easily-swappable-parameters
CharTypdefsToIgnore to CharTypedefsToIgnore in bugprone-signed-char-misuse
clang-tidy now displays warnings from all non-system headers by default. Previously, users had to explicitly opt-in to header warnings using -header-filter=’.*’. To disable warnings from non-system, set -header-filter to an empty string.
Improvements to clangd¶
Inlay hints¶
Diagnostics¶
Semantic Highlighting¶
Compile flags¶
Hover¶
Code completion¶
Code actions¶
New
Override pure virtual methodscode action. When invoked on a class definition, this action automatically generates C++overridedeclarations for all pure virtual methods inherited from its base classes that have not yet been implemented. The generated method stubs prompts the user for the actual implementation. The overrides are intelligently grouped under their original access specifiers (e.g.,public,protected), creating new access specifier blocks if necessary.
Signature help¶
Cross-references¶
Objective-C¶
Miscellaneous¶
Improvements to clang-doc¶
Improvements to clang-query¶
Matcher queries interpreted by clang-query are now support trailing comma (,) in matcher arguments. Note that C++ still doesn’t allow this in function arguments. So when porting a query to C++, remove all instances of trailing comma (otherwise C++ compiler will just complain about “expected expression”).
Improvements to clang-tidy¶
The check_clang_tidy.py tool now recognizes the
-stdargument when run over C files. If-stdis not specified, it defaults toc99-or-later.clang-tidy now displays warnings from all non-system headers by default. Previously, users had to explicitly opt-in to header warnings using -header-filter=’.*’. To disable warnings from non-system, set -header-filter to an empty string.
clang-tidy no longer attempts to analyze code from system headers by default, greatly improving performance. This behavior is disabled if the SystemHeaders option is enabled.
clang-tidy now supports query based custom checks by CustomChecks configuration option. Query Based Custom Check Document
The run-clang-tidy.py and clang-tidy-diff.py scripts now run checks in parallel by default using all available hardware threads. Both scripts display the number of threads being used in their output.
Improved run-clang-tidy.py by adding a new option enable-check-profile to enable per-check timing profiles and print a report based on all analyzed files.
Improved documentation of the -line-filter command-line flag of clang-tidy and run-clang-tidy.py.
Improved clang-tidy option -quiet by suppressing diagnostic count messages.
Improved clang-tidy by not crashing when an empty directory field is used in a compilation database; the current working directory will be used instead, and an error message will be printed.
Removed clang-tidy’s global options IgnoreMacros and StrictMode, which were documented as deprecated since clang-tidy-20. Users should use the check-specific options of the same name instead.
Improved run-clang-tidy.py and clang-tidy-diff.py scripts by adding the -hide-progress option to suppress progress and informational messages.
Deprecated the clang-tidy
zirconmodule. All checks have been moved to thefuchsiamodule instead. Thezirconmodule will be removed in the 24th release.
New checks¶
New bugprone-derived-method-shadowing-base-method check.
Finds derived class methods that shadow a (non-virtual) base class method.
New bugprone-invalid-enum-default-initialization check.
Detects default initialization (to 0) of variables with
enumtype where the enum has no enumerator with value of 0.New cppcoreguidelines-pro-bounds-avoid-unchecked-container-access check.
Finds calls to
operator[]in STL containers and suggests replacing them with safe alternatives.New google-runtime-float check.
Finds uses of
long doubleand suggests against their use due to lack of portability.New llvm-mlir-op-builder check.
Checks for uses of MLIR’s old/to be deprecated
OpBuilder::create<T>form and suggests usingT::createinstead.New llvm-use-ranges check.
Finds calls to STL library iterator algorithms that could be replaced with LLVM range-based algorithms from
llvm/ADT/STLExtras.h.New misc-override-with-different-visibility check.
Finds virtual function overrides with different visibility than the function in the base class.
New readability-redundant-parentheses check.
Detect redundant parentheses.
New readability-redundant-typename check.
Finds redundant uses of the
typenamekeyword.
New check aliases¶
Renamed cert-dcl50-cpp to modernize-avoid-variadic-functions keeping initial check as an alias to the new one.
Renamed cert-dcl58-cpp to bugprone-std-namespace-modification keeping initial check as an alias to the new one.
Renamed cert-env33-c to bugprone-command-processor keeping initial check as an alias to the new one.
Renamed cert-err34-c to bugprone-unchecked-string-to-number-conversion keeping initial check as an alias to the new one.
Renamed cert-err52-cpp to modernize-avoid-setjmp-longjmp keeping initial check as an alias to the new one.
Renamed cert-err58-cpp to bugprone-throwing-static-initialization keeping initial check as an alias to the new one.
Renamed cert-flp30-c to bugprone-float-loop-counter keeping initial check as an alias to the new one.
Renamed cert-mem57-cpp to bugprone-default-operator-new-on-overaligned-type keeping initial check as an alias to the new one.
Renamed cert-oop57-cpp to bugprone-raw-memory-call-on-non-trivial-type keeping initial check as an alias to the new one.
Renamed cert-oop58-cpp to bugprone-copy-constructor-mutates-argument keeping initial check as an alias to the new one.
Changes in existing checks¶
Improved bugprone-easily-swappable-parameters check by correcting a spelling mistake on its option
NamePrefixSuffixSilenceDissimilarityTreshold.Improved bugprone-exception-escape check’s handling of lambdas: exceptions from captures are now diagnosed, exceptions in the bodies of lambdas that aren’t actually invoked are not. Additionally, fixed an issue where the check wouldn’t diagnose throws in arguments to functions or constructors.
Improved bugprone-infinite-loop check by adding detection for variables introduced by structured bindings.
Improved bugprone-invalid-enum-default-initialization with new IgnoredEnums option to ignore specified enums during analysis.
Improved bugprone-narrowing-conversions check by fixing false positive from analysis of a conditional expression in C.
Improved bugprone-not-null-terminated-result check by fixing bogus fix-its for
strncmpandwcsncmpon Windows and a crash caused by certain value-dependent expressions.Improved bugprone-reserved-identifier check by ignoring declarations and macros in system headers.
Improved bugprone-signed-char-misuse check by fixing false positives on C23 enums with the fixed underlying type of signed char.
Improved bugprone-sizeof-expression check by fixing a crash on
sizeofof an array of dependent type.Improved bugprone-suspicious-include check by adding IgnoredRegex option.
Improved bugprone-tagged-union-member-count by fixing a false positive when enums or unions from system header files or the
stdnamespace are treated as the tag or the data part of a user-defined tagged union respectively.Improved bugprone-throw-keyword-missing check by only considering the canonical types of base classes as written and adding a note on the base class that triggered the warning.
Improved bugprone-unchecked-optional-access check by supporting
NullableValue::makeValueandNullableValue::makeValueInplaceto prevent false-positives forBloombergLP::bdlb::NullableValuetype.Improved bugprone-unhandled-self-assignment check by adding an additional matcher that generalizes the copy-and-swap idiom pattern detection.
Improved cppcoreguidelines-avoid-non-const-global-variables check by adding a new option AllowThreadLocal that suppresses warnings on non-const global variables with thread-local storage duration.
Improved cppcoreguidelines-init-variables check by fixing the insertion location for function pointers with multiple parameters.
Improved cppcoreguidelines-macro-usage check by excluding macro bodies that starts with
__attribute__((..))keyword. Such a macro body is unlikely a proper expression and so suggesting users an impossible rewrite into a template function should be avoided.Improved cppcoreguidelines-prefer-member-initializer check to avoid false positives on inherited members in class templates.
Improved cppcoreguidelines-pro-bounds-pointer-arithmetic check adding an option to allow pointer arithmetic via prefix/postfix increment or decrement operators.
Improved llvm-prefer-isa-or-dyn-cast-in-conditionals check:
Fix-it handles callees with nested-name-specifier correctly.
ifstatements with init-statement (if (auto X = ...; ...)) are handled correctly.forloops are supported.
Improved misc-const-correctness check to avoid false positives when pointers is transferred to non-const references and avoid false positives of function pointer and fix false positives on return of non-const pointer and fix false positives on pointer-to-member operator.
Improved misc-header-include-cycle check performance.
Improved modernize-avoid-c-arrays to not diagnose array types which are part of an implicit instantiation of a template.
Improved modernize-use-constraints check by fixing a crash on uses of non-standard
enable_ifwith a signature different fromstd::enable_if(such asboost::enable_if).Improved modernize-use-default-member-init check to enhance the robustness of the member initializer detection.
Improved modernize-use-designated-initializers check to suggest using designated initializers for aliased aggregate types.
Improved modernize-use-integer-sign-comparison by providing correct fix-its when the right-hand side of a comparison contains a non-C-style cast.
Improved modernize-use-nullptr check by fixing a crash on Windows when the check was enabled with a 32-bit clang-tidy binary.
Improved modernize-use-scoped-lock check by fixing a crash on malformed code (common when using clang-tidy through clangd).
Improved modernize-use-std-format check to correctly match when the format string is converted to a different type by an implicit constructor call.
Improved modernize-use-std-print check to correctly match when the format string is converted to a different type by an implicit constructor call.
Improved performance-unnecessary-copy-initialization by printing the type of the diagnosed variable.
Improved performance-unnecessary-value-param by printing the type of the diagnosed variable and correctly generating fix-it hints for parameter-pack arguments.
Improved portability-template-virtual-member-function check to avoid false positives on pure virtual member functions.
Improved readability-container-contains to support string comparisons to
npos. Internal changes may cause new rare false positives in non-standard containers.Improved readability-container-size-empty check by correctly generating fix-it hints when size method is called from implicit
this, ignoring default constructors with user provided arguments and adding detection in container’s method exceptempty.Improved readability-identifier-naming check by ignoring declarations and macros in system headers. The documentation is also improved to differentiate the general options from the specific ones. Options for fine-grained control over
constexprvariables were added.Improved readability-implicit-bool-conversion check by correctly adding parentheses when the inner expression are implicitly converted multiple times.
Improved readability-qualified-auto check by adding the option IgnoreAliasing, that allows not looking at underlying types of type aliases.
Improved readability-uppercase-literal-suffix check to recognize literal suffixes added in C++23 and C23.
Improved readability-use-concise-preprocessor-directives check to generate correct fix-its for forms without a space after the directive.
Removed checks¶
Miscellaneous¶
Improvements to include-fixer¶
The improvements are…
Improvements to clang-include-fixer¶
The improvements are…
Improvements to modularize¶
The improvements are…