whileLoop

Coverity Documentation

Version
latest

Matches standard while loops.

This matches standard while loops, as opposed to do ... while and for loops.

This pattern only matches nodes of type statement.

Properties

whileLoop produces a record that contains the following properties:

Name Type Description
bodyStatement statement The body of the loop
conditionDeclaration variableDeclaration? If a variable is declared in the condition expression, it is represented here; null if there is no declaration
conditionExpression expression The expression in the condition of the loop

Inherits properties from:

Example

The following CodeXM pattern matches situations where a while loop has a Boolean constant value as its condition:


CXM code follows
    pattern whileLoopBoolConstantCondition {
        whileLoop {
            .conditionExpression == booleanLiteral
        }
    };