9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
12#include "../cppcoreguidelines/NarrowingConversionsCheck.h"
107 "bugprone-argument-comment");
109 "bugprone-assert-side-effect");
111 "bugprone-assignment-in-if-condition");
113 "bugprone-bad-signal-to-kill-thread");
115 "bugprone-bitwise-pointer-cast");
117 "bugprone-bool-pointer-implicit-conversion");
120 "bugprone-casting-through-void");
122 "bugprone-chained-comparison");
124 "bugprone-compare-pointer-to-member-virtual-function");
126 "bugprone-copy-constructor-init");
128 "bugprone-dangling-handle");
130 "bugprone-dynamic-static-initializers");
132 "bugprone-easily-swappable-parameters");
135 "bugprone-exception-escape");
138 "bugprone-forward-declaration-namespace");
140 "bugprone-forwarding-reference-overload");
142 "bugprone-implicit-widening-of-multiplication-result");
144 "bugprone-inaccurate-erase");
146 "bugprone-incorrect-enable-if");
148 "bugprone-return-const-ref-from-parameter");
150 "bugprone-switch-missing-default-case");
152 "bugprone-inc-dec-in-conditions");
154 "bugprone-incorrect-roundings");
157 "bugprone-integer-division");
159 "bugprone-lambda-function-name");
161 "bugprone-macro-parentheses");
163 "bugprone-macro-repeated-side-effects");
165 "bugprone-misplaced-operator-in-strlen-in-alloc");
167 "bugprone-misplaced-pointer-arithmetic-in-alloc");
169 "bugprone-misplaced-widening-cast");
171 "bugprone-move-forwarding-reference");
173 "bugprone-multi-level-implicit-pointer-conversion");
175 "bugprone-multiple-new-in-one-expression");
177 "bugprone-multiple-statement-macro");
179 "bugprone-nondeterministic-pointer-iteration-order");
181 "bugprone-optional-value-conversion");
183 "bugprone-pointer-arithmetic-on-polymorphic-object");
185 "bugprone-redundant-branch-condition");
187 "bugprone-narrowing-conversions");
190 "bugprone-non-zero-enum-to-bool-conversion");
192 "bugprone-not-null-terminated-result");
194 "bugprone-parent-virtual-call");
197 "bugprone-reserved-identifier");
199 "bugprone-shared-ptr-array-mismatch");
202 "bugprone-signed-char-misuse");
204 "bugprone-sizeof-container");
206 "bugprone-sizeof-expression");
208 "bugprone-spuriously-wake-up-functions");
210 "bugprone-standalone-empty");
212 "bugprone-string-constructor");
214 "bugprone-string-integer-assignment");
216 "bugprone-string-literal-with-embedded-nul");
218 "bugprone-stringview-nullptr");
220 "bugprone-suspicious-enum-usage");
222 "bugprone-suspicious-include");
224 "bugprone-suspicious-memory-comparison");
226 "bugprone-suspicious-memset-usage");
228 "bugprone-suspicious-missing-comma");
230 "bugprone-suspicious-realloc-usage");
232 "bugprone-suspicious-semicolon");
234 "bugprone-suspicious-string-compare");
236 "bugprone-suspicious-stringview-data-usage");
238 "bugprone-swapped-arguments");
240 "bugprone-tagged-union-member-count");
242 "bugprone-terminating-continue");
244 "bugprone-throw-keyword-missing");
246 "bugprone-too-small-loop-variable");
248 "bugprone-unchecked-optional-access");
250 "bugprone-undefined-memory-manipulation");
252 "bugprone-undelegated-constructor");
254 "bugprone-unhandled-self-assignment");
256 "bugprone-unhandled-exception-at-new");
258 "bugprone-unique-ptr-array-mismatch");
260 "bugprone-crtp-constructor-accessibility");
262 "bugprone-unsafe-functions");
264 "bugprone-unused-local-non-trivial-variable");
267 "bugprone-unused-return-value");
270 "bugprone-virtual-near-miss");
277static ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
278 X(
"bugprone-module",
"Adds checks for bugprone code constructs.");
A collection of ClangTidyCheckFactory instances.
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Finds assert() with side effect.
Catches assignments within the condition clause of an if statement.
Finds pthread_kill function calls when thread is terminated by SIGTERM signal.
Warns about code that tries to cast between pointers by means of std::bit_cast or memcpy.
Checks for conditions based on implicit conversion from a bool pointer to bool.
A check for detecting if/else if/else chains where two or more branches are Type I clones of each oth...
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Detects unsafe or redundant two-step casting operations involving void*.
Check detects chained comparison operators that can lead to unintended behavior or logical errors.
Detects unspecified behavior about equality comparison between pointer to member virtual function and...
Finds copy constructors where the ctor don't call the copy constructor of the base class.
Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP can be constructed outs...
Detect dangling references in value handlers like std::experimental::string_view.
Finds dynamically initialized static variables in header files.
Finds function definitions where parameters of convertible types follow each other directly,...
Detects and suggests addressing issues with empty catch statements.
Finds functions which should not throw exceptions: Destructors, move constructors,...
Find and flag invalid initializer values in folds, e.g.
Checks if an unused forward declaration is in a wrong namespace.
The checker looks for constructors that can act as copy or move constructors through their forwarding...
Diagnoses instances of an implicit widening of multiplication result.
Checks for inaccurate use of the erase() method.
Detects when a variable is both incremented/decremented and referenced inside a complex condition and...
Detects incorrect usages of std::enable_if that don't name the nested type type.
Checks the usage of patterns known to produce incorrect rounding.
Finds obvious infinite loops (loops where the condition variable is not changed at all).
Finds cases where integer division in a floating point context is likely to cause unintended loss of ...
Detect when func or FUNCTION is being used from within a lambda.
Finds macros that can have unexpected behaviour due to missing parentheses.
Checks for repeated argument with side effects in macros.
Finds cases where 1 is added to the string in the argument to a function in the strlen() family inste...
Finds cases where an integer is added to or subracted from the result of a memory allocation function...
Find casts of calculation results to bigger type.
The check warns if std::move is applied to a forwarding reference (i.e.
Detects implicit conversions between pointers of different levels of indirection.
For the user-facing documentation see: http://clang.llvm.org/extra/clang-tidy/checks/bugprone/multipl...
Detect multiple statement macros that are used in unbraced conditionals.
Block arguments in dispatch_async() and dispatch_after() are guaranteed to escape.
Detect implicit and explicit casts of enum type into bool where enum type doesn't have a zero-value e...
Finds nondeterministic usages of pointers in unordered containers.
Finds function calls where it is possible to cause a not null-terminated result.
Detects potentially unintentional and redundant conversions where a value is extracted from an option...
Finds calls to grand..-parent virtual methods instead of parent's.
Finds pointer arithmetic performed on classes that contain a virtual function.
Finds condition variables in nested if statements that were also checked in the outer if statement an...
Checks for usages of identifiers reserved for use by the implementation.
Detects return statements that return a constant reference parameter as constant reference.
Find std::shared_ptr<T>(new T[...]), replace it (if applicable) with std::shared_ptr<T[]>(new T[....
Checker for signal handler functions.
Finds those signed char -> integer conversions which might indicate a programming error.
Find usages of sizeof on expressions of STL container types.
Find suspicious usages of sizeof expressions.
Finds cnd_wait, cnd_timedwait, wait, wait_for, or wait_until function calls when the function is not ...
Checks for ignored calls to empty() on a range and suggests clear() as an alternative if it is an exi...
Finds suspicious string constructor and check their parameters.
Finds instances where an integer is assigned to a string.
Find suspicious string literals with embedded NUL characters.
Checks for various ways that the const CharT* constructor of std::basic_string_view can be passed a n...
The checker detects various cases when an enum is probably misused (as a bitmask).
Warns on inclusion of files whose names suggest that they're implementation files,...
Finds potentially incorrect calls to memcmp() based on properties of the arguments.
Finds memset calls with potential mistakes in their arguments.
This check finds string literals which are probably concatenated accidentally.
Finds usages of realloc where the return value is assigned to the same variable as passed to the firs...
This check finds semicolon that modifies the meaning of the program unintendedly.
Find suspicious calls to string compare functions.
Identifies suspicious usages of std::string_view::data() that could lead to reading out-of-bounds dat...
Finds potentially swapped arguments by looking at implicit conversions.
Ensures that switch statements without default cases are flagged, focuses only on covering cases with...
Gives warnings for tagged unions, where the number of tags is different from the number of data membe...
Checks if a 'continue' statement terminates the loop (i.e.
Emits a warning about temporary objects whose type is (or is derived from) a class that has 'EXCEPTIO...
This check gives a warning if a loop variable has a too small type which might not be able to represe...
Warns when the code is unwrapping a std::optional<T>, absl::optional<T>, or base::std::optional<T> ob...
Finds calls of memory manipulation functions memset(), memcpy() and memmove() on non-TriviallyCopyabl...
Finds creation of temporary objects in constructors that look like a function call to another constru...
Finds calls to 'new' that may throw unhandled exception at allocation failure.
Finds user-defined copy assignment operators which do not protect the code against self-assignment ei...
Finds initializations of C++ unique pointers to non-array type that are initialized with an array.
Checks for functions that have safer, more secure replacements available, or are considered deprecate...
Warns when a local non trivial variable is unused within a function.
Finds temporaries that look like RAII objects.
Detects function calls where the return value is unused.
The check warns if an object is used after it has been moved, without an intervening reinitialization...
Checks for near miss of virtual methods.
Checks for narrowing conversions, e.g: int i = 0; i += 0.1;.
volatile int BugproneModuleAnchorSource