File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
cpp/common/src/codingstandards/cpp Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -389,12 +389,21 @@ class LegacyForLoopCondition extends RelationalOperation {
389389 Expr loopBound ;
390390
391391 LegacyForLoopCondition ( ) {
392- loopCounter = this .getAnOperand ( ) .getAChild * ( ) and
393- loopBound = this .getAnOperand ( ) and
394- loopCounter .getTarget ( ) = getAnIterationVariable ( forLoop ) and
395- loopBound != loopCounter
392+ this = forLoop .getCondition ( ) and
393+ exists ( Expr loopCounterExpr |
394+ loopCounterExpr = this .getAnOperand ( ) and
395+ loopBound = this .getAnOperand ( ) and
396+ loopCounter = loopCounterExpr .getAChild * ( ) and
397+ loopCounter .getTarget ( ) = getAnIterationVariable ( forLoop ) and
398+ loopBound != loopCounterExpr
399+ )
396400 }
397401
402+ /**
403+ * Gets the for-loop this expression is a termination condition of.
404+ */
405+ ForStmt getForLoop ( ) { result = forLoop }
406+
398407 /**
399408 * Gets the variable access to the loop counter variable, appearing in this loop condition.
400409 */
You can’t perform that action at this time.
0 commit comments