Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2116400

Browse files
committed
RefineLegacyForLoopCondition
1 parent82f9adc commit2116400

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎cpp/common/src/codingstandards/cpp/Loops.qll‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,21 @@ class LegacyForLoopCondition extends RelationalOperation {
389389
ExprloopBound;
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(ExprloopCounterExpr|
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+
ForStmtgetForLoop(){result=forLoop}
406+
398407
/**
399408
* Gets the variable access to the loop counter variable, appearing in this loop condition.
400409
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp