CodeQL library for C/C++
codeql/cpp-all 2.1.1 (changelog, source)
Search

Module Nullness

Provides classes and predicates for working with null values and checks for nullness.

Import path

import semmle.code.cpp.controlflow.Nullness

Imports

DefinitionsAndUses

Provides classes and predicates for reasoning about definitions and uses of variables.

cpp

Provides classes and predicates for working with C/C++ code.

Predicates

callMayReturnNull

Holds if call may, directly or indirectly, evaluate to a null literal.

checkedNull

Holds if var is likely to be null at node.

checkedValid

Holds if var is likely to be non-null at node.

mayReturnNull

Holds if f may, directly or indirectly, return a null literal.

nullCheckExpr

Holds if var is null when checkExpr evaluates to a true value.

nullInit

Holds if the evaluation of n may have the effect of, directly or indirectly, assigning a null literal to var.

nullValue

Holds if val is a null literal or a call to a function that may return a null literal.

validCheckExpr

Holds if var is non-null when checkExpr evaluates to a true value.

Classes

AnalysedExpr

An expression that has been extended with member predicates that provide information about the role of this expression in nullness checks.

NullValue

A C/C++ literal whose value is considered null.

Zero

A C/C++ literal whose value is zero.