CLion 2020.1 Help

List of C/C++ inspections

Data flow analysis

This set of inspections is provided by Clangd (when enabled) or by the built-in language engine (when Clangd is disabled).

Inspection

Description

Default Severity

Constant conditions

Analyzes method control and data flow to report conditions that are always true or false and expressions with statically constant values.

Warning Warning

Endless loop

Detects the for, while, and goto statements that can break only by throwing an exception.

Warning Warning

Infinite recursion

Detects when a function produces infinite recursion.

Warning Warning

Local value escapes scope

Detects variables that reference local variables that escape their scope.

Warning Warning

Missing return

Reports when a non-void function doesn't have a return statement, or when it can exit bypassing it.

Warning Warning

Not initialized variable

Detects the local variables that haven't been initialized before usage.

Warning Warning

Null dereferences

Detects dereferences of pointers that may contain the nullptr.

Warning Warning

Unreachable code

Detects the code that is never executed (dead code).

Warning Warning

Unused local variable

Detects the variables that are declared but not used and never accessed for reading.

Warning Warning

Unused parameter

Detects the parameters that are declared but not used and never accessed for reading.

Warning Warning

Unused value

Reports the cases when the value of a variable is never used after the assignment.

Warning Warning

Declaration order

These inspections work only when the Clangd-based engine is turned off.

Inspection

Description

Default Severity

Function implicit declaration

Reports when a function is used prior to being declared.

Warning Warning

Hides upper scope

Reports local variables declared in the scope of other local variables or parameters with the same name.

Warning Warning

Functions

Inspection

Description

Default Severity

Hiding non-virtual function

Reports when a function hides non-virtual functions with the same signature from the base class.

Warning Warning

Not implemented functions

Detects when a function is declared but not defined.

Warning Warning

Passing arguments to function with K&R unspecified parameters syntax

Reports when a function with the K&R parameters syntax uses a non-empty argument list.

Works only when the Clangd-based engine is turned off.

Warning Warning

General

Inspection

Description

Default Severity

Argument selection defects

Compares the names of arguments in a call and formal parameter names in the declaration to detect the errors like accidental switching of the arguments.

See Inspection: Argument Selection Defects for details.

Warning Warning

Clang-Tidy

Performs various clang-tidy checks related to C++ Core Guidelines, code modernization, readability, and performance issues.

See Clang-Tidy Integration for details.

Warning Warning

Duplicate switch case

Reports duplicated case expressions and overlapping case ranges in switch statements.

Works only when the Clangd-based engine is turned off.

Warning Warning

Empty declaration or statement

Reports the redundant empty declarations and statements that can be safely removed.

Requires the Clangd-based engine to be enabled.

Warning Warning

Format specifiers

Detects when a call to a string format function (such as NSLog or printf) has inconsistent format specifier, wrong argument type, or incorrect number of arguments.

Works only when the Clangd-based engine is turned off.

Warning Warning

'=' in conditional expression

Detects when the = operator is used in conditional expressions where there should be ==.

Works only when the Clangd-based engine is turned off.

Warning Warning

Inconsistent Naming

Reports when a symbol violates the currently selected naming convention.

Find more details in Inspecting code for violations of the naming rules.

Disabled

Loop condition isn't updated inside the loop

Reports when a loop condition doesn't change its value inside the loop.

Warning Warning

Missing switch case

Reports when a switch statement don't include all of the enumerated type's elements as cases. It also reports switch statements over an integer type that don't include a default: branch.

Works only when the Clangd-based engine is turned off.

Warning Warning

Resource not found

Reports unresolved references to resources like NIBs, images, and others.

Works only when the Clangd-based engine is turned off.

Warning Warning

Simplifiable statement

Finds code parts that can be simplified. For example, constant conditions, identical if branches, or unused boolean expressions.

Warning Warning

Usage of deprecated API

Detects the usages of deprecated code in the specified scope.

Works only when the Clangd-based engine is turned off.

Warning Warning

Virtual call from constructor or destructor

Reports when a virtual function is called from a constructor or destructor, helping to prevent situations when virtual functions access the resources that are not yet initialized or have already been destroyed.

Requires the Clangd-based engine to be enabled.

Warning Warning

Type checks

These inspections work only when the Clangd-based engine is turned off.

Inspection

Description

Default Severity

Implicit integer and enum conversion

Detects when a num type expression is used in the context of an integer or pointer type, and vice versa.

Warning Warning

Implicit pointer and integer conversion

Detects when an integer type expression is used in the context of a pointer type, and vice versa.

Warning Warning

Incompatible enums

Reports the cases when an expression of the enum type A is used in the context of another enum type B (assigned, casted, used in a parameter, returned from a method, function or a block, and so on).

Warning Warning

Incompatible initializers

Reports the cases when a variable initializer doesn't match the declared type. For example, when there are too many initializers for an array or structure.

Warning Warning

Incompatible pointers

Reports when an expression of a pointer type A is used in the context of another pointer type B (assigned, casted, used in a parameter, returned from a method, function or a block, and so on).

This inspection doesn't check class type pointers.

Warning Warning

Not superclass

Reports when an expression of type A is used in the context of type B, whereas A and B are class types, and B is not a superclass of A.

Warning Warning

Redundant cast

Reports unnecessary type cast expressions.

Warning Warning

Signedness mismatch

Reports when an expression of a signed type is used in the context of an unsigned type (assigned, casted, used in a parameter, returned from a method, function or a block, and so on).

Warning Warning

Value may not fit into receiver

Reports when an expression of type A is used in the context of type B, while the range of values in type B is not large enough to store all possible values of type A.

Warning Warning

Unused code

Inspection

Description

Default Severity

Unused concepts

Detects C++ concepts that are never used.

Warning Warning

Unused expression result

Reports the expressions whose results are never used.

Warning Warning

Unused global declaration

Detects when a global function or variable is declared but never accessed or written.

Warning Warning

Unused include directive

Reports the unused or unrequired include directives, which can be safely removed.

Requires the Clangd-based engine to be enabled.

See Inspection: Unused Include Directive for details.

Warning Warning

Unused macro

Detects macro definitions that are never used in the code.

Warning Warning

Unused struct

Detects C/C++ classes and structures that are never used.

Warning Warning

Unused template parameter

Detects C++ class and function template parameters that are never used.

Warning Warning
Last modified: 27 May 2020