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

Predicate bbSuccessorEntryReachesLoopInvariant

Loop invariant for bbSuccessorEntryReaches:

  • succ is a successor of pred.
  • predSkipsFirstLoopAlwaysTrueUponEntry: whether the path from pred (via succ) skips the first loop where the condition is provably true upon entry.
  • succSkipsFirstLoopAlwaysTrueUponEntry: whether the path from succ skips the first loop where the condition is provably true upon entry.
  • If pred contains the entry point of a loop where the condition is provably true upon entry, then succ is not allowed to skip that loop (succSkipsFirstLoopAlwaysTrueUponEntry = false).

Import path

import semmle.code.cpp.controlflow.StackVariableReachability
predicate bbSuccessorEntryReachesLoopInvariant(BasicBlock pred, BasicBlock succ, boolean predSkipsFirstLoopAlwaysTrueUponEntry, boolean succSkipsFirstLoopAlwaysTrueUponEntry)