Function SgNodeHelper::loopRelevantBreakStmtNodes

Function SgNodeHelper::loopRelevantBreakStmtNodes#

Function Documentation#

std::set<SgNode*> SgNodeHelper::loopRelevantBreakStmtNodes(SgNode *node)#

returns a set of SgNode where each node is a break node, but properly excludes all nested loops.

The only property this function maintains during traversal of the AST is that it does not collect break nodes from nested loops but only from the current scope. Only those breaks are loop-relevant, meaning only those can force an exit of the loop. Break statements inside if statements or Conditional Expressions inside the loop are handled properly. Excluded are only constructs where a break statement refers to that nested loop but not the current (=relevant) loop. This function can be used for: SgWhile,SgDoWhile,SgForStatement, SgSwitch.

Parameters:

node[in] can point directly to the AST construct (e.g. SgIfStatement) or a basic block of the respective loop construct.