clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-integer-sign-comparison
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-nodiscard
By default this check will replace throw() with noexcept, and throw(<exception>[,...]) or throw(...) with noexcept(false). The check is deprecated. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-noexcept
NULL, 0) to use the new C++11 and C23 nullptr keyword. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-nullptr
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-override
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-ranges
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-scoped-lock
Notably, this will work with std::string and std::string_view. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-starts-ends-with
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-std-bit
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-std-format
Does not match the use of variables with that value, and instead, offers a replacement for the definition of those variables. Function calls that match the pattern of how the constant is calculated are matched and replaced with the std::numbers constant. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-std-numbers
The replaced and replacement functions can be customised by configuration options. Each argument that is the result of a call to std::string::c_str() and std::string::data() will have that now-unnecessary call removed in a similar manner to the. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-std-print
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-string-view
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-structured-binding
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-to-underlying
This transformation is purely stylistic. The return type before the function name is replaced by auto and inserted after the function parameter list (and qualifiers). clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-trailing-return-type
When using transparent functors, the type does not need to be repeated. The code is easier to read, maintain and less prone to errors. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-transparent-functors
The check is deprecated. clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-uncaught-exceptions
clang-tidy can fix the code that it finds. The check is in the modernize module of clang-tidy.
- Code
modernize-use-using
Buffers should be passed as a single pointer or array. As MPI function signatures specify void * for their buffer types, insufficiently dereferenced buffers can be passed, like for example as double pointers or multidimensional arrays, without a compiler warning emitted. clang-tidy can fix the code that it finds. The check is in the mpi module of clang-tidy.
- Code
mpi-buffer-deref
All MPI datatypes defined by the MPI standard (3.1) are verified by this check. User defined typedefs, custom MPI datatypes and null pointer constants are skipped, in the course of verification. clang-tidy can fix the code that it finds. The check is in the mpi module of clang-tidy.
- Code
mpi-type-mismatch
clang-tidy runs it as the check clang-analyzer-nullability.NullReturnedFromNonnull. It applies to C, C++, Objective-C.
- Code
nullability.NullReturnedFromNonnull
clang-tidy can fix the code that it finds. The check is in the objc module of clang-tidy.
- Code
objc-assert-equals
The check is in the objc module of clang-tidy.
- Code
objc-avoid-nserror-init
The category implementation will override any -dealloc in the class implementation, potentially causing issues. The check is in the objc module of clang-tidy.
- Code
objc-dealloc-in-category
The check is in the objc module of clang-tidy.
- Code
objc-forbidden-subclassing
The check is in the objc module of clang-tidy.
- Code
objc-missing-hash
Certain format specifiers are undesirable despite being legal. See http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns for all legal date patterns. The check is in the objc module of clang-tidy.
- Code
objc-nsdate-formatter
When passing Objective-C objects as parameters to the NSInvocation methods getArgument:atIndex: and getReturnValue:, the values are copied by value into the argument pointer, which leads to incorrect releasing behavior if the object pointers are not declared __unsafe_unretained. clang-tidy can fix the code that it finds. The check is in the objc module of clang-tidy.
- Code
objc-nsinvocation-argument-lifetime
The property name should be in the format of Lower Camel Case. clang-tidy can fix the code that it finds. The check is in the objc module of clang-tidy.
- Code
objc-property-declaration
clang-tidy can fix the code that it finds. The check is in the objc module of clang-tidy.
- Code
objc-super-self
The check is in the openmp module of clang-tidy.
- Code
openmp-exception-escape
The check is in the openmp module of clang-tidy.
- Code
openmp-use-default-none
This is not necessarily undefined behavior, but can lead to nasty surprises, so projects may decide to use a coding standard that disallows these "unusual" conversions. It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.core.EnumCastOutOfRange. It applies to C, C++.
- Code
optin.core.EnumCastOutOfRange
It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.core.FixedAddressDereference. It applies to C, C++, Objective-C.
- Code
optin.core.FixedAddressDereference
It is possible to use such functions safely (as long as they always receive at least one variadic argument), but their careless use can lead to undefined behavior (trying to access a variadic argument when there isn't any), so it is better to avoid them. It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.core.UnconditionalVAArg. It applies to C, C++.
- Code
optin.core.UnconditionalVAArg
It doesn't only find direct uninitialized fields, but rather makes a deep inspection of the object, analyzing all of its fields' subfields. The checker regards inherited fields as direct fields, so one will receive warnings for uninitialized inherited data members as well. It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.cplusplus.UninitializedObject. It applies to C++.
- Code
optin.cplusplus.UninitializedObject
It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.cplusplus.VirtualCall. It applies to C++.
- Code
optin.cplusplus.VirtualCall
It is an opt-in checker, so the analyzer runs it only when you enable it.
- Code
optin.mpi.MPI
It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.performance.GCDAntipattern.
- Code
optin.performance.GCDAntipattern
It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.performance.Padding. It applies to C, C++, Objective-C.
- Code
optin.performance.Padding
It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.portability.UnixAPI.
- Code
optin.portability.UnixAPI
It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.taint.GenericTaint. It applies to C, C++.
- Code
optin.taint.GenericTaint
If an attacker can inject a large value as the size parameter, memory exhaustion denial of service attack can be carried out. It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.taint.TaintedAlloc. It applies to C, C++.
- Code
optin.taint.TaintedAlloc
If the attacker can set the denominator to 0, a runtime error can be triggered. The checker warns when the denominator is a tainted value and the analyzer cannot prove that it is not 0. It is an opt-in checker, so the analyzer runs it only when you enable it. clang-tidy runs it as the check clang-analyzer-optin.taint.TaintedDiv. It applies to C, C++, Objective-C.
- Code
optin.taint.TaintedDiv
clang-tidy runs it as the check clang-analyzer-osx.cocoa.AutoreleaseWrite.
- Code
osx.cocoa.AutoreleaseWrite
clang-tidy runs it as the check clang-analyzer-osx.cocoa.Loops.
- Code
osx.cocoa.Loops
clang-tidy runs it as the check clang-analyzer-osx.cocoa.NonNilReturnValue.
- Code
osx.cocoa.NonNilReturnValue
clang-tidy runs it as the check clang-analyzer-osx.cocoa.RunLoopAutoreleaseLeak.
- Code
osx.cocoa.RunLoopAutoreleaseLeak
clang-tidy runs it as the check clang-analyzer-osx.NumberObjectConversion. It applies to C, C++, Objective-C.
- Code
osx.NumberObjectConversion
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-avoid-endl
Analyzes the values of the enumerators in an enum or enum class, including signed values, to recommend the smallest possible underlying type that can represent all the values of the enum. The suggested underlying types are the integral types std::uint8_t, std::uint16_t, and std::uint32_t for unsigned types, and std::int8_t, std::int16_t, and std::int32_t for signed types. The check is in the performance module of clang-tidy.
- Code
performance-enum-size
These methods return by value, which involves copying the contained value. value() and operator* return references and can be used to avoid the copy when appropriate. clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-expensive-value-or
It is an alias of the check performance-prefer-single-char-overloads, which does the same work. clang-tidy can fix the code that it finds.
- Code
performance-faster-string-find
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-for-range-copy
This means that an implicit conversion happens, which can for example result in expensive deep copies. The check is in the performance module of clang-tidy.
- Code
performance-implicit-conversion-in-loop
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-inefficient-algorithm
The check is in the performance module of clang-tidy.
- Code
performance-inefficient-string-concatenation
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-inefficient-vector-operation
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-move-const-arg
The check is in the performance module of clang-tidy.
- Code
performance-move-constructor-init
The check is in the performance module of clang-tidy.
- Code
performance-no-automatic-move
The check is in the performance module of clang-tidy.
- Code
performance-no-int-to-ptr
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-noexcept-destructor
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-noexcept-move-constructor
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-noexcept-swap
The character literal overload is more efficient. clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-prefer-single-char-overloads
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-string-view-conversions
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-trivially-destructible
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-type-promotion-in-math-fn
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-unnecessary-copy-initialization
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-unnecessary-value-param
clang-tidy can fix the code that it finds. The check is in the performance module of clang-tidy.
- Code
performance-use-std-move
The check is in the portability module of clang-tidy.
- Code
portability-avoid-pragma-once
Use of inline assembly should be avoided since it ties to a specific CPU architecture and syntax making code that uses it non-portable across platforms. The check is in the portability module of clang-tidy.
- Code
portability-no-assembler
clang-tidy can fix the code that it finds. The check is in the portability module of clang-tidy.
- Code
portability-restrict-system-includes
The check is in the portability module of clang-tidy.
- Code
portability-simd-intrinsics
These are not allowed in standard C++, and should usually be std::vector<T> instead.". The check is in the portability module of clang-tidy.
- Code
portability-std-allocator-const
The check is in the portability module of clang-tidy.
- Code
portability-template-virtual-member-function
Having a reset method in both classes makes it easy to accidentally make the pointer null when intending to reset the underlying object. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-ambiguous-smartptr-reset-call
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-avoid-const-params-in-decls
The check is in the readability module of clang-tidy.
- Code
readability-avoid-nested-conditional-operator
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-avoid-return-with-void-value
The check is in the readability module of clang-tidy.
- Code
readability-avoid-unconditional-preprocessor-if
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-braces-around-statements
Such use of const is usually superfluous, and can prevent valuable compiler optimizations. Does not (yet) fix trailing return types. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-const-return-type
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-container-contains
This pattern is commonly used to materialize a pointer to the backing data of a container. std::vector and std::string provide a data() accessor to retrieve the data pointer which should be preferred. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-container-data-pointer
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-container-size-empty
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-convert-member-functions-to-static
The check is unnecessary as deleting a null pointer has no effect. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-delete-null-pointer
The check maintains a list of included files and looks for duplicates. If a macro is defined or undefined then the list of included files is cleared. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-duplicate-include
Early exit is one of the suggested enforcements of that. Please do not use else or else if after something that interrupts control flow - like return, break, continue, throw. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-else-after-return
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-enum-initial-value
The check is in the readability module of clang-tidy.
- Code
readability-function-cognitive-complexity
The check is in the readability module of clang-tidy.
- Code
readability-function-size
The desired name length is configurable. Special short names which should be ignored can be specified. The check is in the readability module of clang-tidy.
- Code
readability-identifier-length
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-identifier-naming
Depending on use case, it may simply help with readability of the code, or in some cases, point to potential bugs which remain unnoticed due to implicit conversions. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-implicit-bool-conversion
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-inconsistent-declaration-parameter-name
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-inconsistent-ifelse-braces
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-isolate-declaration
The check is in the readability module of clang-tidy.
- Code
readability-magic-numbers
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-make-member-function-const
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-math-missing-parentheses
Mismatch of the syntactical structure and the indentation of the code may hide serious problems. Missing braces can also make it significantly harder to read the code, therefore it is important to use braces. The check is in the readability module of clang-tidy.
- Code
readability-misleading-indentation
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-misplaced-array-index
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-named-parameter
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-non-const-parameter
The check supports both traditional and alternative representations of operators, such as && and and, || and or, and so on. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-operators-representation
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-qualified-auto
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-access-specifiers
Covers a range of explicit casting operations, including static_cast, const_cast, C-style casts, and reinterpret_cast. Its primary objective is to enhance code readability and maintainability by eliminating unnecessary type casting. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-casting
Such return statements are redundant. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-control-flow
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-declaration
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-function-ptr-dereference
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-inline-specifier
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-lambda-parameter-list
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-member-init
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-nested-if
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-parentheses
At the moment the following cases are detected. The check is in the readability module of clang-tidy.
- Code
readability-redundant-preprocessor
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-qualified-alias
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-smartptr-get
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-string-cstr
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-string-init
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-typename
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-redundant-zero-initializer
The check is in the readability module of clang-tidy.
- Code
readability-reference-to-constructed-temporary
Simplifies boolean expressions by application of DeMorgan's Theorem. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-simplify-boolean-expr
Currently this covers calling .data() and immediately doing an array subscript operation to obtain a single element, in which case simply calling operator[] suffice. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-simplify-subscript-expr
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-static-accessed-through-instance
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-static-definition-in-anonymous-namespace
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-string-compare
The check is in the readability module of clang-tidy.
- Code
readability-suspicious-call-argument
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-trailing-comma
The check is in the readability module of clang-tidy.
- Code
readability-trivial-switch
The latter is shorter, simpler and does not require use of raw pointer APIs. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-uniqueptr-delete-release
By default, only the suffixes that begin with l (l, ll, lu, llu, but not u, ul, ull) are diagnosed by that alias. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-uppercase-literal-suffix
In C++20 mode, suggests std::ranges::any_of or std::ranges::all_of. The check is in the readability module of clang-tidy.
- Code
readability-use-anyofallof
clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-use-concise-preprocessor-directives
Note: This may impact performance in critical code due to potential additional stores compared to the original if statement. clang-tidy can fix the code that it finds. The check is in the readability module of clang-tidy.
- Code
readability-use-std-min-max
This usually means incorrect indexing, but the checker also detects access via the operators * and ->. clang-tidy runs it as the check clang-analyzer-security.ArrayBound. It applies to C, C++.
- Code
security.ArrayBound
clang-tidy runs it as the check clang-analyzer-security.cert.env.InvalidPtr.
- Code
security.cert.env.InvalidPtr
clang-tidy runs it as the check clang-analyzer-security.VAList. It applies to C, C++.
- Code
security.VAList
- Code
unix
Blocking functions detected by this checker: sleep, getc, fgets, read, recv. Critical section handling functions modeled by this checker: lock, unlock, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock, mtx_lock, mtx_timedlock, mtx_trylock, mtx_unlock, lock_guard, unique_lock, scoped_lock. clang-tidy runs it as the check clang-analyzer-unix.BlockInCriticalSection. It applies to C, C++.
- Code
unix.BlockInCriticalSection
clang-tidy runs it as the check clang-analyzer-unix.MismatchedDeallocator. It applies to C, C++.
- Code
unix.MismatchedDeallocator
Only ref-counted types are allowed. clang-tidy runs it as the check clang-analyzer-webkit.NoUncountedMemberChecker.
- Code
webkit.NoUncountedMemberChecker
clang-tidy runs it as the check clang-analyzer-webkit.RefCntblBaseVirtualDtor.
- Code
webkit.RefCntblBaseVirtualDtor
When creating a RetainPtr or OSObjectPtr with +1 semantics, adoptNS, adoptCF, or adoptOSObject should be used, and in +0 semantics, RetainPtr or OSObjectPtr constructor should be used. Warn otherwise. It is an experimental (alpha) checker, so the analyzer does not run it by default.
- Code
webkit.RetainPtrCtorAdoptChecker
Only ref-counted types are allowed. clang-tidy runs it as the check clang-analyzer-webkit.UncountedLambdaCapturesChecker.
- Code
webkit.UncountedLambdaCapturesChecker