ANTAREX API

Clava API

LARA API

LARA Common Language API

(.js)
laraImport("clava.code.ForToWhileStmt");

(.lara)
import clava.code.ForToWhileStmt;

Global Functions

ForToWhileStmt

ForToWhileStmt($forStmt, stepLabelSuffix)

Replaces for loop with an equivalent construct based on a while loop:
```c
for (init; cond; step) {
...
continue;
...
...
}
```
becomes
```c
{
init;
while (cond) {
...
goto __for_loop_step_${step_label_suffix};
...
...
__for_loop_step_${step_label_suffix}:
step;
}
}
```

Parameters

$forStmt: $loop - For-loop joinpoint
stepLabelSuffix: number|string - Suffix to attach to the for loop step label, added in case there are `continue` statements to account for

Returns

any - The newly created replacement joinpoint