The motivation of this path is to catch code like this:<div><br></div><div>for (int i = 0; i < 10; ++i)</div><div> for (int j = 0; j < 10; ++i)</div><div> { }</div><div><br></div><div>The second for loop increments i instead of j causing an infinite loop. The warning also checks the body of the for loop so it will trigger on:</div>
<div><br></div><div>for (int i; i <10; ) { }</div><div><br></div><div>But not trigger on:</div><div><br></div><div>for (int i; i< 10; ) { ++i; }</div><div><br></div><div>I'm still fine-tuning the trigger conditions, but would like some feedback on this patch.</div>