Files
codeql/cpp/ql/test/successor-tests/whilestmt/whilestmt01.ql
2018-08-02 17:53:23 +01:00

16 lines
500 B
Plaintext

/**
* @name whilestmt01
* @description The statement following the while statement in normal is a successor of the condition.
*/
import cpp
from WhileStmt ws, int k, LabelStmt l
where
ws.getEnclosingFunction().hasName("normal")
and ws.getParentStmt().hasChild(ws, k)
and ws.getParentStmt().hasChild(l, k + 1)
and l = ws.getCondition().getASuccessor()
and l = ws.getCondition().getAFalseSuccessor()
and count(ws.getCondition().getAFalseSuccessor()) = 1
select ws.getCondition(), l.getName()