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

Module Assertions

Import path

import semmle.code.cpp.commons.Assertions

Imports

cpp

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

Classes

Assertion

An assertion, that is, a condition that is only false if there is a bug in the program. To add support for more, define additional subclasses. A typical subclass will extend extend either MacroInvocation (for assertion macros) or FunctionCall (for assertion functions).

LibcAssert

A libc assert, as defined in assert.h. A macro with a head that matches the prefix “assert(”, and expands to a conditional expression which may terminate the program.

MacroAssert

A macro assert that expands to an if statement; the head is taken to be “Assert(x, y)”, but further alternatives could be added.

RecoverableAssert

An assertion that is not completely disabled in release builds but returns a Boolean value to enable recovery from unexpected anomalous behavior. This style of assert is advocated by the Power of 10 rules and the NASA JPL Coding Standard.