Official docs:
Finds pointers with the noescape attribute that are captured by an
asynchronously-executed block. The block arguments in dispatch_async()
and dispatch_after() are guaranteed to escape, so it is an error if a
pointer with the noescape attribute is captured by one of these
blocks.
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.