| Code Issue / Checker |
LLVM/Clang Equivalent
and Documentation |
Default
Level |
Fixable |
Introduced
in Build |
| bugprone |
|
|
|
|
| Checks that argument comments match parameter names |
bugprone-argument-comment
|
4 |
 |
2488 |
| Finds potentially unintended bool pointer instead of bool in an if statement |
bugprone-bool-pointer-implicit-conversion |
3 |
 |
2476 |
| Finds incompletely erasing use of the erase() method |
bugprone-inaccurate-erase |
3 |
 |
2476 |
| Finds cases where integer division in a floating point context may cause unintended loss of precision |
bugprone-integer-division |
2 |
 |
2583 |
| Finds cases where 1 is added to the string in the argument to strlen(), strnlen(), strnlen_s(), wcslen(), wcsnlen(), and wcsnlen_s() instead of the result, and the value is used as an argument to a memory allocation function (malloc(), calloc(), realloc(), alloca()) or the new[] operator in C++ |
bugprone-misplaced-operator-in-strlen-in-alloc |
3 |
 |
2583 |
| Finds cases where an integer expression is added to or subtracted from the result of a memory allocation function (malloc(), calloc(), realloc(), alloca()) instead of its argument |
bugprone-misplaced-pointer-arithmetic-in-alloc |
3 |
 |
2583 |
| Finds initializations of C++ shared pointers to non-array types that are initialized with an array |
bugprone-shared-ptr-array-mismatch |
3 |
 |
2583 |
| Finds suspicious string constructors |
bugprone-string-constructor |
3 |
 |
2406 |
| Finds suspicious assignments of integers to strings |
bugprone-string-integer-assignment |
3 |
 |
2463 |
| 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-stringview-nullptr |
3 |
 |
2583 |
| Finds potentially incorrect calls to memcmp() based on properties of the arguments |
bugprone-suspicious-memory-comparison |
2 |
 |
2583 |
| Finds memset() calls with potential mistakes in their arguments |
bugprone-suspicious-memset-usage |
3 |
 |
2583 |
Finds usages of realloc where the return value is assigned to the same expression as passed to the first argument: p = realloc(p, size);
If realloc fails, it returns a null pointer but does not deallocate the original memory |
bugprone-suspicious-realloc-usage |
2 |
 |
2583 |
| Finds potentially unintended semicolon |
bugprone-suspicious-semicolon |
3 |
 |
2583 |
| Finds bug-prone usage of string comparison functions |
bugprone-suspicious-string-compare |
3 |
 |
2406 |
| Finds potentially swapped arguments by looking at implicit conversions |
bugprone-swapped-arguments |
4 |
 |
2488 |
| Finds calls of memory manipulation functions memset(), memcpy(), and memmove() on non-TriviallyCopyable objects resulting in undefined behavior |
bugprone-undefined-memory-manipulation |
2 |
 |
2583 |
| Finds user-defined copy assignment operators which do not protect the code against self-assignment either by checking self-assignment explicitly or using the copy-and-swap or the copy-and-move method |
bugprone-unhandled-self-assignment |
2 |
 |
2583 |
| Finds initializations of C++ unique pointers to non-array types that are initialized with an array |
bugprone-unique-ptr-array-mismatch |
3 |
 |
2583 |
| Warns if an object is used after it has been moved |
bugprone-use-after-move |
2 |
 |
2583 |
| cert |
|
|
|
|
| Warns on unused function return values |
cert-err33-c |
2 |
 |
2583 |
| Finds all static or thread_local variable declarations where the initializer for the object may throw an exception |
cert-err58-cpp |
2 |
 |
2583 |
| Warns for the usage of std::rand() |
cert-msc50-cpp |
2 |
 |
2583 |
| Flags all pseudo-random number engines, engine adaptor instantiations, and srand() when initialized or seeded with a default argument, constant expression, or any user-configurable type |
cert-msc51-cpp |
2 |
 |
2583 |
| clang |
|
|
|
|
| Checks for logical errors in function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers) |
clang-analyzer-core.CallAndMessage |
2 |
 |
2583 |
| Checks for divisions by zero |
clang-analyzer-core.DivideZero |
2 |
 |
2583 |
| Checks for null pointers passed as arguments to a function whose arguments are references or marked with the ‘nonnull’ attribute |
clang-analyzer-core.NonNullParamChecker |
2 |
 |
2583 |
| Checks for dereferences of null pointers |
clang-analyzer-core.NullDereference |
2 |
 |
2583 |
| Checks for undefined results of binary operators |
clang-analyzer-core.UndefinedBinaryOperatorResult |
2 |
 |
2583 |
| Checks for assigning uninitialized values |
clang-analyzer-core.uninitialized.Assign |
2 |
 |
2583 |
| Checks for uninitialized values used as branch conditions |
clang-analyzer-core.uninitialized.Branch |
2 |
 |
2583 |
| Checks for uninitialized values being returned to the caller |
clang-analyzer-core.uninitialized.UndefReturn |
2 |
 |
2583 |
| Checks for inner pointers of C++ containers used after re/deallocation |
clang-analyzer-cplusplus.InnerPointer |
2 |
 |
2583 |
| Finds use-after-move bugs in C++. This includes method calls on moved-from objects, assignment of a moved-from object, and repeated move of a moved-from object |
clang-analyzer-cplusplus.Move |
2 |
 |
2583 |
| Checks for double-free and use-after-free problems. Traces memory managed by new/delete |
clang-analyzer-cplusplus.NewDelete |
2 |
 |
2583 |
| Checks for memory leaks. Traces memory managed by new/delete |
clang-analyzer-cplusplus.NewDeleteLeaks |
2 |
 |
2583 |
| Checks situations where restricted polymorphism causes a call to a pure virtual method |
clang-analyzer-cplusplus.PureVirtualCall |
2 |
 |
2583 |
| Checks C++ copy and move assignment operators for self assignment |
clang-analyzer-cplusplus.SelfAssignment |
2 |
 |
2583 |
| Warns when a nullable pointer is dereferenced |
clang-analyzer-nullability.NullableDereferenced |
2 |
 |
2583 |
| Warns when a nullable pointer is returned from a function that has a _Nonnull return type |
clang-analyzer-nullability.NullableReturnedFromNonnull |
2 |
 |
2583 |
| cppcoreguidelines |
|
|
|
|
| Checks whether there are local variables that are declared without an initial value |
cppcoreguidelines-init-variables |
3 |
 |
2583 |
| Checks for silent narrowing conversions, e.g: int i = 0; i += 0.1; |
cppcoreguidelines-narrowing-conversions |
2 |
 |
2583 |
| Handles C-Style memory management using malloc(), realloc(), calloc() and free() |
cppcoreguidelines-no-malloc |
2 |
 |
2583 |
| Implements the type-based semantics of gsl::owner<T*>, which allows static analysis on code that uses raw pointers to handle resources like dynamic memory, but won’t introduce RAII concepts |
cppcoreguidelines-owning-memory |
2 |
 |
2583 |
| Flags user-provided constructor definitions that leave fields uninitialized |
cppcoreguidelines-pro-type-member-init |
2 |
 |
2458 |
| Flags all uses of reinterpret_cast in C++ code |
cppcoreguidelines-pro-type-reinterpret-cast |
2 |
 |
2583 |
| Flags all usages of static_cast, where a base class is casted to a derived class |
cppcoreguidelines-pro-type-static-cast-downcast |
3 |
 |
2583 |
| Finds classes where some but not all of the special member functions are defined |
cppcoreguidelines-special-member-functions |
2 |
 |
2583 |
| misc |
|
|
|
|
| Checks for unused and missing includes |
misc-include-cleaner |
3 |
 |
2583 |
| Flags overloaded operator new() and operator delete() functions that do not have a corresponding free store function defined within the same scope |
misc-new-delete-overloads |
2 |
 |
2583 |
| Dereferences and non-pointer declarations of objects that are not meant to be passed by value, such as C FILE objects or POSIX pthread_mutex_t objects |
misc-non-copyable-objects |
2 |
 |
2583 |
| Replaces assert() with static_assert() if the condition is evaluable at compile time |
misc-static-assert |
3 |
|
2583 |
| Finds violations of the rule “Throw by value, catch by reference” |
misc-throw-by-value-catch-by-reference |
2 |
 |
2583 |
| Finds unused function parameters |
misc-unused-parameters |
3 |
 |
2583 |
| modernize |
|
|
|
|
| Finds C-style array types and recommends using std::array<> / std::vector<> |
modernize-avoid-c-arrays |
2 |
 |
2583 |
| Replaces C standard library headers with their C++ alternatives and removes redundant ones |
modernize-deprecated-headers |
3 |
 |
2375 |
| Converts for loops to range-based loops |
modernize-loop-convert |
3 |
 |
2210 |
| Converts std::shared_ptr creation to std::make_shared |
modernize-make-shared |
3 |
 |
2210 |
| Converts std::unique_ptr creation to std::make_unique |
modernize-make-unique |
3 |
 |
2210 |
| Replaces string literals containing escaped characters with raw string literals |
modernize-raw-string-literal |
3 |
 |
2217 |
| Finds and removes redundant void argument lists |
modernize-redundant-void-arg |
5 |
 |
2210 |
| Replaces std::random_shuffle with std::shuffle |
modernize-replace-random-shuffle |
3 |
 |
2283 |
| Replaces explicit calls to the constructor in a return with a braced initializer list |
modernize-return-braced-init-list |
3 |
 |
2387 |
| Replaces copy-and-swap container with shrink_to_fit() |
modernize-shrink-to-fit |
3 |
 |
2235 |
| Uses 'auto' for variable declarations |
modernize-use-auto |
5 |
 |
2210 |
| Finds integer literals which are cast to bool |
modernize-use-bool-literals |
3 |
 |
2235 |
| Converts constructors’ member initializers into the new default member initializers in C++11 |
modernize-use-default-member-init |
3 |
 |
2583 |
| Replaces push_back with emplace_back |
modernize-use-emplace |
3 |
 |
2210 |
| Replaces default bodies of special member functions with = default; |
modernize-use-equals-default |
3 |
 |
2210 |
|
Identifies unimplemented private special member functions and recommends using = delete for them
Relocates any deleted member function from the private to the public section
|
modernize-use-equals-delete |
3 |
 |
2583 |
| Replaces deprecated dynamic exception specifications with the appropriate noexcept specification |
modernize-use-noexcept |
3 |
 |
2583 |
| Converts the null pointer constants with nullptr |
modernize-use-nullptr |
3 |
 |
2210 |
| Adds override to overridden virtual functions and removes virtual from those functions |
modernize-use-override |
3 |
 |
2210 |
| Replaces non-transparent functors with transparent functors |
modernize-use-transparent-functors |
3 |
 |
2248 |
| Converts typedef with 'using' declaration |
modernize-use-using |
3 |
 |
2210 |
| performance |
|
|
|
|
| Optimizes std::string::find() calls using single character literals |
performance-faster-string-find |
3 |
 |
2399 |
| Uses const references for expensive range-based loop variables |
performance-for-range-copy |
3 |
 |
2248 |
| Replaces STL algorithms with associative container methods |
performance-inefficient-algorithm |
3 |
 |
2393 |
| Detects inefficient std::vector operations (e.g. push_back, emplace_back) that may cause unnecessary memory reallocations |
performance-inefficient-vector-operation |
3 |
 |
2399 |
| Removes unnecessary std::move() calls |
performance-move-const-arg |
3 |
 |
2451 |
| Flags user-defined destructors marked with noexcept(expr) where expr evaluates to false |
performance-noexcept-destructor |
3 |
 |
2583 |
| Flags user-defined move constructors and assignment operators not marked with noexcept or marked with noexcept(expr) where expr evaluates to false |
performance-noexcept-move-constructor |
3 |
 |
2451 |
| Flags user-defined swap and iter_swap functions not marked with noexcept or marked with noexcept(expr) where expr evaluates to false |
performance-noexcept-swap |
3 |
 |
2583 |
| Finds types that can be trivially destructible by removing defaulted destructors |
performance-trivially-destructible |
3 |
 |
2583 |
| Replaces unnecessary copies with const references |
performance-unnecessary-copy-initialization |
3 |
 |
2248 |
| readability |
|
|
|
|
| Replaces size()/length() methods with empty() |
readability-container-size-empty |
5 |
 |
2219 |
| Avoids else after return, break, continue, or throw |
readability-else-after-return |
5 |
 |
2387 |
| Detects magic numbers, integer or floating point literals embedded in code and not introduced via constants or symbols |
readability-magic-numbers |
5 |
|
2506 |
| Removes redundant return and continue statements |
readability-redundant-control-flow |
5 |
 |
2219 |
| Removes unnecessary member initializations |
readability-redundant-member-init |
5 |
 |
2380 |
| Finds and removes redundant calls to smart pointer’s .get() method |
readability-redundant-smartptr-get |
5 |
 |
2219 |
| Finds unnecessary calls to std::string::c_str() and std::string::data() |
readability-redundant-string-cstr |
4 |
 |
2380 |
| Finds unnecessary string initializations |
readability-redundant-string-init |
4 |
 |
2380 |
| Finds string comparisons using the compare method |
readability-string-compare.html |
4 |
 |
2458 |
| Replace delete <unique_ptr>.release() with <unique_ptr> = nullptr |
readability-uniqueptr-delete-release |
3 |
 |
2219 |