Official docs:
This check will warn when there is a cast of a calculation result to a
bigger type. If the intention of the cast is to avoid loss of
precision then the cast is misplaced, and there can be loss of
precision. Otherwise the cast is ineffective.
Official docs:
The check looks for perfect forwarding constructors that can hide copy
or move constructors. If a non const lvalue reference is passed to the
constructor, the forwarding reference parameter will be a better match
than the const reference parameter of the copy constructor, so the
perfect forwarding constructor will be called, which can be confusing.
Official docs:
Finds instances of static variables that are dynamically initialized in
header files. This can pose problems in certain multithreaded contexts.
Official docs:
Adds pointer qualifications to auto-typed variables that are deduced to
pointers. This makes it obvious if a auto typed variable is a pointer.
This check will transform auto to auto * when the type is deduced to be
a pointer.
Official docs:
Replaces assert() with static_assert() if the condition is evaluable
at compile time. The condition of static_assert() is evaluated at
compile time which is safer and more efficient.
Official docs:
Finds assert() with side effect. The condition of assert() is
evaluated only in debug builds so a condition with side effect can
cause different behavior in debug / release builds.
Official docs:
This check replaces the uses of the deprecated class std::auto_ptr by
std::unique_ptr (introduced in C++11). The transfer of ownership, done
by the copy-constructor and the assignment operator, is changed to
match std::unique_ptr usage by using explicit calls to std::move().
Official docs:
The check diagnoses any static_assert declaration with an empty string
literal and provides a fix-it to replace the declaration with a
single-argument static_assert declaration.
Official docs:
Correct indentation helps to understand code. Mismatch of the
syntactical structure and the indentation of the code may hide serious
problems.
Instead of disabling all checks + specifying which are enabled
(whitelist), enable all checks + specify which checks are disabled
(blacklist). The same set of checks executes as before.
Motivation:
a) Given the goal to (generally) enable as many checks as possible, a
blacklist produces a smaller and easier to maintain .clang-tidy file.
b) Many new checks introduced with LLVM 12/13/14 were forgotten to turn
on. A blacklist makes sure that future compiler upgrades enable new
checks by default.
Omitted new checks which produce too many matches or which are
controversial (e.g. readability-identifier-length).
New checks:
- misc-misleading-bidirectional + misc-misleading-identifier
Detects potential attack as described in the Trojan Source attack
- modernize-macro-to-enum
Replaces groups of adjacent macros with an unscoped anonymous enum
- modernize-shrink-to-fit
Replace copy and swap tricks on shrinkable containers with the
shrink_to_fit() method call
- modernize-use-transparent-functors
Prefer transparent functors to non-transparent ones
- modernize-use-uncaught-exceptions
This check will warn on calls to std::uncaught_exception and replace
them with calls to std::uncaught_exceptions (uncaught_exception was
deprecated with C++17)
- performance-no-int-to-ptr
Diagnoses every integer to pointer cast
- readability-duplicate-include
Looks for duplicate includes and removes them
- readability-redundant-preprocessor
Finds potentially redundant preprocessor directives
- bugprone-lambda-function-name
Checks for attempts to get the name of a function from within a lambda
expression
- bugprone-redundant-branch-condition
Finds condition variables in nested if statements that were also
checked in the outer if statement and were not changed
- bugprone-shared-ptr-array-mismatch
Finds initializations of C++ shared pointers to non-array type that
are initialized with an array
- bugprone-stringview-nullptr
Checks for various ways that the const CharT* constructor of
std::basic_string_view can be passed a null argument and replaces them
with the default constructor in most cases
- bugprone-suspicious-memory-comparison
Finds potentially incorrect calls to memcmp() based on properties of
the arguments
- not having everyone append new checks at the end means fewer merge
conflicts
- also removed check "misc-unconventional-assign-operator" which was
duplicated