9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
12#include "../cppcoreguidelines/NarrowingConversionsCheck.h"
104 "bugprone-argument-comment");
106 "bugprone-assert-side-effect");
108 "bugprone-assignment-in-if-condition");
110 "bugprone-bad-signal-to-kill-thread");
112 "bugprone-bool-pointer-implicit-conversion");
115 "bugprone-casting-through-void");
117 "bugprone-chained-comparison");
119 "bugprone-compare-pointer-to-member-virtual-function");
121 "bugprone-copy-constructor-init");
123 "bugprone-dangling-handle");
125 "bugprone-dynamic-static-initializers");
127 "bugprone-easily-swappable-parameters");
130 "bugprone-exception-escape");
133 "bugprone-forward-declaration-namespace");
135 "bugprone-forwarding-reference-overload");
137 "bugprone-implicit-widening-of-multiplication-result");
139 "bugprone-inaccurate-erase");
141 "bugprone-incorrect-enable-if");
143 "bugprone-return-const-ref-from-parameter");
145 "bugprone-switch-missing-default-case");
147 "bugprone-inc-dec-in-conditions");
149 "bugprone-incorrect-roundings");
152 "bugprone-integer-division");
154 "bugprone-lambda-function-name");
156 "bugprone-macro-parentheses");
158 "bugprone-macro-repeated-side-effects");
160 "bugprone-misplaced-operator-in-strlen-in-alloc");
162 "bugprone-misplaced-pointer-arithmetic-in-alloc");
164 "bugprone-misplaced-widening-cast");
166 "bugprone-move-forwarding-reference");
168 "bugprone-multi-level-implicit-pointer-conversion");
170 "bugprone-multiple-new-in-one-expression");
172 "bugprone-multiple-statement-macro");
174 "bugprone-optional-value-conversion");
176 "bugprone-pointer-arithmetic-on-polymorphic-object");
178 "bugprone-redundant-branch-condition");
180 "bugprone-narrowing-conversions");
183 "bugprone-non-zero-enum-to-bool-conversion");
185 "bugprone-not-null-terminated-result");
187 "bugprone-parent-virtual-call");
190 "bugprone-reserved-identifier");
192 "bugprone-shared-ptr-array-mismatch");
195 "bugprone-signed-char-misuse");
197 "bugprone-sizeof-container");
199 "bugprone-sizeof-expression");
201 "bugprone-spuriously-wake-up-functions");
203 "bugprone-standalone-empty");
205 "bugprone-string-constructor");
207 "bugprone-string-integer-assignment");
209 "bugprone-string-literal-with-embedded-nul");
211 "bugprone-stringview-nullptr");
213 "bugprone-suspicious-enum-usage");
215 "bugprone-suspicious-include");
217 "bugprone-suspicious-memory-comparison");
219 "bugprone-suspicious-memset-usage");
221 "bugprone-suspicious-missing-comma");
223 "bugprone-suspicious-realloc-usage");
225 "bugprone-suspicious-semicolon");
227 "bugprone-suspicious-string-compare");
229 "bugprone-suspicious-stringview-data-usage");
231 "bugprone-swapped-arguments");
233 "bugprone-terminating-continue");
235 "bugprone-throw-keyword-missing");
237 "bugprone-too-small-loop-variable");
239 "bugprone-unchecked-optional-access");
241 "bugprone-undefined-memory-manipulation");
243 "bugprone-undelegated-constructor");
245 "bugprone-unhandled-self-assignment");
247 "bugprone-unhandled-exception-at-new");
249 "bugprone-unique-ptr-array-mismatch");
251 "bugprone-crtp-constructor-accessibility");
253 "bugprone-unsafe-functions");
255 "bugprone-unused-local-non-trivial-variable");
258 "bugprone-unused-return-value");
261 "bugprone-virtual-near-miss");
268static ClangTidyModuleRegistry::Add<bugprone::BugproneModule>
269 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.
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 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 expression.
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...
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