sonar-delphi icon indicating copy to clipboard operation
sonar-delphi copied to clipboard

Add control flow graph implementation

Open jgardn3r opened this issue 1 year ago • 2 comments

This PR adds the notion of a control flow graph. Control flow graphs are a stepping stone in data flow analysis and symbolic execution.

With just the control flow graph alone, two new rules could be implemented:

  • RedundantJump
  • LoopExecutingAtMostOnce

In addition to that, some more API traversal methods were added:

  • RepeatStatementNode::getGuardExpression
  • RepeatStatementNode::getStatements
  • CaseStatementNode::getSelectorExpression
  • CaseItemStatementNode::getStatement

The thinking is that the control flow graph will be internal for a while before being exposed in the stable API. In light of this, I have made a ControlFlowGraph interface in the API, but there are no public ways to create/interact with it.

jgardn3r avatar Aug 07 '24 05:08 jgardn3r