Extra Clang Tools 23.0.0git (In-Progress) Release Notes¶
Written by the LLVM Team
Warning
These are in-progress notes for the upcoming Extra Clang Tools 23 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 23.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 23.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 check performance-faster-string-find. It has been renamed to performance-prefer-single-char-overloads. The original check will be removed in the 25th release.
Improvements to clangd¶
Inlay hints¶
Diagnostics¶
Semantic Highlighting¶
Compile flags¶
Hover¶
Code completion¶
Now also provides include files without extension, if they are in a directory only called
include.
Code actions¶
Signature help¶
Cross-references¶
Objective-C¶
Miscellaneous¶
Improvements to clang-doc¶
Improvements to clang-query¶
Improvements to clang-tidy¶
Improved check_clang_tidy.py script by adding the -check-header argument to simplify testing of header files. This argument automatically manages the creation of temporary header files and ensures that diagnostics and fixes are verified for the specified headers.
Improved clang-tidy
-store-check-profileby generating valid JSON when the source file path contains characters that require JSON escaping.
New checks¶
New bugprone-unsafe-to-allow-exceptions check.
Finds functions where throwing exceptions is unsafe but the function is still marked as potentially throwing.
New llvm-type-switch-case-types check.
Finds
llvm::TypeSwitch::Casecalls with redundant explicit template arguments that can be inferred from the lambda parameter type.New llvm-use-vector-utils check.
Finds calls to
llvm::to_vector(llvm::map_range(...))andllvm::to_vector(llvm::make_filter_range(...))that can be replaced withllvm::map_to_vectorandllvm::filter_to_vector.New modernize-use-std-bit check.
Finds common idioms which can be replaced by standard functions from the
<bit>C++20 header.New modernize-use-string-view check.
Looks for functions returning
std::[w|u8|u16|u32]stringand suggests to change it tostd::[...]string_viewfor performance reasons if possible.New modernize-use-structured-binding check.
Finds places where structured bindings could be used to decompose pairs and suggests replacing them.
New performance-string-view-conversions check.
Finds and removes redundant conversions from
std::[w|u8|u16|u32]string_viewtostd::[...]stringin call expressions expectingstd::[...]string_view.New performance-use-std-move check.
Suggests insertion of
std::move(...)to turn copy assignment operator calls into move assignment ones, when deemed valid and profitable.New readability-redundant-qualified-alias check.
Finds redundant identity type aliases that re-expose a qualified name and can be replaced with a
usingdeclaration.New readability-trailing-comma check.
Checks for presence or absence of trailing commas in enum definitions and initializer lists.
New check aliases¶
Renamed hicpp-exception-baseclass to bugprone-std-exception-baseclass. The hicpp-exception-baseclass name is kept as an alias.
Renamed hicpp-ignored-remove-result to bugprone-unused-return-value. The hicpp-ignored-remove-result name is kept as an alias.
Renamed hicpp-no-assembler to portability-no-assembler. The hicpp-no-assembler name is kept as an alias.
Renamed performance-faster-string-find to performance-prefer-single-char-overloads. The performance-faster-string-find name is kept as an alias.
Changes in existing checks¶
Improved bugprone-argument-comment to also check for C++11 inherited constructors.
Improved bugprone-bad-signal-to-kill-thread check by fixing false negatives when the
SIGTERMmacro is obtained from a precompiled header.Improved bugprone-casting-through-void check by running only on C++ files because suggested
reinterpret_castis not available in pure C.Improved bugprone-derived-method-shadowing-base-method check by correctly ignoring function templates.
Improved bugprone-exception-escape check by adding TreatFunctionsWithoutSpecificationAsThrowing option to support reporting for unannotated functions, enabling reporting when no explicit
throwis seen and allowing separate tuning for known and unknown implementations.Improved bugprone-fold-init-type check by detecting precision loss in overloads with transparent standard functors (e.g.
std::plus<>) forstd::accumulate,std::reduce, andstd::inner_product.Improved bugprone-inc-dec-in-conditions check by fixing a false positive when increment/decrement operators appear inside lambda bodies that are part of a condition expression.
Improved bugprone-macro-parentheses check by printing the macro definition in the warning message if the macro is defined on command line.
Improved bugprone-pointer-arithmetic-on-polymorphic-object check by fixing a false positive when
operator[]is used in a dependent context.Improved bugprone-std-namespace-modification check by fixing false positives when extending the standard library with a specialization of user-defined type and by removing detection of the compiler generated
stdnamespace extensions.Improved bugprone-string-constructor check to detect suspicious string constructor calls when the string class constructor has a default allocator argument.
Improved bugprone-unchecked-optional-access to recognize common GoogleTest macros such as
ASSERT_TRUEandASSERT_FALSE, reducing the number of false positives in test code.Improved bugprone-unsafe-functions check by adding the function
std::get_temporary_bufferto the default list of unsafe functions. (This function is unsafe, useless, deprecated in C++17 and removed in C++20).Improved bugprone-use-after-move check:
Include the name of the invalidating function in the warning message when a custom invalidation function is used (via the InvalidationFunctions option).
Add support for annotation of user-defined types as having the same moved-from semantics as standard smart pointers.
Improved cppcoreguidelines-init-variables check by ensuring that member pointers are correctly flagged as uninitialized.
Improved cppcoreguidelines-missing-std-forward check by fixing a false positive for constrained template parameters.
Improved cppcoreguidelines-pro-type-vararg check by no longer warning on builtins with custom type checking (e.g., type-generic builtins like
__builtin_clzg) that use variadic declarations as an implementation detail.Improved cppcoreguidelines-rvalue-reference-param-not-moved check by fixing a false positive on implicitly generated functions such as inherited constructors.
Improved llvm-use-ranges check by adding support for the following algorithms:
std::accumulate,std::replace_copy, andstd::replace_copy_if.Improved misc-const-correctness check:
Added support for analyzing function parameters with the AnalyzeParameters option.
Fixed false positive where an array of pointers to
constwas incorrectly diagnosed as allowing the pointee to be madeconst.Fixed false positive where a pointer used with placement new was incorrectly diagnosed as allowing the pointee to be made
const.
Improved misc-multiple-inheritance by avoiding false positives when virtual inheritance causes concrete bases to be counted more than once.
Improved misc-throw-by-value-catch-by-reference check:
Fixed the WarnOnLargeObject option to use the correct name when storing the configuration.
Fixed the CheckThrowTemporaries option to correctly reflect its configured value in exported settings.
Improved misc-unused-using-decls to not diagnose
usingdeclarations as unused if they’re exported from a module.Improved modernize-pass-by-value check by adding IgnoreMacros option to suppress warnings in macros.
Improved modernize-redundant-void-arg check to work in C23.
Improved modernize-use-equals-delete check by only warning on private deleted functions, if they do not have a public overload or are a special member function.
Improved modernize-use-std-format check:
Fixed a crash when an argument is part of a macro expansion.
Added missing
#includeinsertion when the format function call appears as an argument to a macro.
Improved modernize-use-std-print check by adding missing
#includeinsertion when the format function call appears as an argument to a macro.Improved modernize-use-trailing-return-type check by fixing spurious
missing '(' after '__has_feature'errors caused by builtin macros appearing in the return type of a function.Improved modernize-use-using check by avoiding the generation of invalid code for function types with redundant parentheses.
Improved performance-enum-size check:
Exclude
enuminextern "C"blocks.Improved the ignore list to correctly handle
typedefandenum.
Improved performance-inefficient-string-concatenation check by adding support for detecting inefficient string concatenation in
do-whileloops.Improved performance-inefficient-vector-operation check by correctly handling vector-like classes when
push_back/emplace_backare inherited.Improved performance-move-const-arg check by avoiding false positives on trivially copyable types with a non-public copy constructor.
Improved performance-prefer-single-char-overloads check:
Now analyzes calls to the
starts_with,ends_with,contains, andoperator+=string member functions.Fixes false negatives when using
std::setfromlibstdc++.
Improved readability-container-size-empty check:
Fix a crash when a member expression has a non-identifier name.
Reduce verbosity by removing the note indicating source location of the
emptyfunction.
Improved readability-else-after-return check:
Fixed missed diagnostics when
ifstatements appear in unbracedswitchcase labels.Fixed a false positive involving
ifstatements which contain areturn,break, etc., jumped over by agoto.Fixed the check potentially breaking code by deleting one too many characters following an
elseor a curly brace.Added support for handling attributed
ifthen-branches such as[[likely]]and[[unlikely]].Diagnose and remove redundant
elsebranches after calls to[[noreturn]]functions.
Improved readability-enum-initial-value check: the warning message now uses separate note diagnostics for each uninitialized enumerator, making it easier to see which specific enumerators need explicit initialization.
Improved readability-implicit-bool-conversion check:
Fixed a false positive where AllowPointerConditions and AllowIntegerConditions options did not suppress warnings when the condition expression involved temporaries (e.g. passing a string literal to a
const std::string¶meter).Warn and provide fix-its when a macro defined in a system header (e.g.
NULL) is implicitly converted tobool.Added AllowLogicalOperatorConversion option to suppress warnings on implicit conversions of logical operator results (
&&,||,!) toboolin C.
Improved readability-non-const-parameter check by avoiding false positives on parameters used in dependent expressions (e.g. inside generic lambdas).
Improved readability-redundant-preprocessor check by fixing a false positive for nested
#ifdirectives using different builtin expressions such as__has_builtinand__has_cpp_attribute.Improved readability-simplify-boolean-expr check to provide valid fix suggestions for C23 and later by not using
static_cast.Improved readability-simplify-subscript-expr check by fixing missing warnings when subscripting an object held inside a generic container (e.g. subscripting a
std::stringheld inside astd::vector<std::string>).Improved readability-suspicious-call-argument check by avoiding a crash from invalid
Abbreviationsoption.