@@ -211,15 +211,8 @@ private newtype TAlertType =
211
211
variableModifiedInExpression ( mutatingExpr , loopBound .( VariableAccess ) .getTarget ( ) .getAnAccess ( ) )
212
212
} or
213
213
/* 5-1-2. The loop bound is not a variable access nor a constant expression. */
214
- TLoopBoundIsNonConstExpr ( ForStmt forLoop , Expr loopBound , Expr mutatingExpr ) {
214
+ TLoopBoundIsNonConstExpr ( ForStmt forLoop , Expr loopBound ) {
215
215
loopBound = forLoop .getCondition ( ) .( LegacyForLoopCondition ) .getLoopBound ( ) and
216
- (
217
- /* The mutating expression may be in the loop body. */
218
- mutatingExpr = forLoop .getStmt ( ) .getChildStmt ( ) .getAChild * ( )
219
- or
220
- /* The mutating expression may be in the loop updating expression. */
221
- mutatingExpr = forLoop .getUpdate ( ) .getAChild * ( )
222
- ) and
223
216
( not loopBound instanceof VariableAccess and not loopBound .isConstant ( ) )
224
217
} or
225
218
/* 5-2-1. The loop step is a variable that is mutated in the for loop. */
@@ -235,15 +228,8 @@ private newtype TAlertType =
235
228
variableModifiedInExpression ( mutatingExpr , loopStep .( VariableAccess ) .getTarget ( ) .getAnAccess ( ) )
236
229
} or
237
230
/* 5-2-2. The loop step is not a variable access nor a constant expression. */
238
- TLoopStepIsNonConstExpr ( ForStmt forLoop , Expr loopStep , Expr mutatingExpr ) {
231
+ TLoopStepIsNonConstExpr ( ForStmt forLoop , Expr loopStep ) {
239
232
loopStep = getLoopStepOfForStmt ( forLoop ) and
240
- (
241
- /* The mutating expression may be in the loop body. */
242
- mutatingExpr = forLoop .getStmt ( ) .getChildStmt ( ) .getAChild * ( )
243
- or
244
- /* The mutating expression may be in the loop updating expression. */
245
- mutatingExpr = forLoop .getUpdate ( ) .getAChild * ( )
246
- ) and
247
233
( not loopStep instanceof VariableAccess and not loopStep .isConstant ( ) )
248
234
} or
249
235
/*
@@ -298,9 +284,9 @@ class AlertType extends TAlertType {
298
284
this = TLoopCounterMutatedInLoopBody ( result , _) or
299
285
this = TLoopCounterSmallerThanLoopBound ( result , _) or
300
286
this = TLoopBoundIsMutatedVariableAccess ( result , _, _) or
301
- this = TLoopStepIsNonConstExpr ( result , _ , _) or
302
- this = TLoopBoundIsMutatedVariableAccess ( result , _, _) or
303
- this = TLoopStepIsNonConstExpr ( result , _, _ ) or
287
+ this = TLoopBoundIsNonConstExpr ( result , _) or
288
+ this = TLoopStepIsMutatedVariableAccess ( result , _, _) or
289
+ this = TLoopStepIsNonConstExpr ( result , _) or
304
290
this = TLoopCounterIsTakenNonConstAddress ( result , _) or
305
291
this = TLoopBoundIsTakenNonConstAddress ( result , _) or
306
292
this = TLoopStepIsTakenNonConstAddress ( result , _)
@@ -321,11 +307,11 @@ class AlertType extends TAlertType {
321
307
result = forLoopCondition .getLoopCounter ( )
322
308
)
323
309
or
324
- this = TLoopBoundIsNonConstExpr ( _, result , _ )
310
+ this = TLoopBoundIsNonConstExpr ( _, result )
325
311
or
326
312
this = TLoopBoundIsMutatedVariableAccess ( _, result , _)
327
313
or
328
- this = TLoopStepIsNonConstExpr ( _, result , _ )
314
+ this = TLoopStepIsNonConstExpr ( _, result )
329
315
or
330
316
this = TLoopStepIsMutatedVariableAccess ( _, result , _)
331
317
or
@@ -355,13 +341,13 @@ class AlertType extends TAlertType {
355
341
this = TLoopBoundIsMutatedVariableAccess ( _, _, _) and
356
342
result = "loop bound"
357
343
or
358
- this = TLoopBoundIsNonConstExpr ( _, _, _ ) and
344
+ this = TLoopBoundIsNonConstExpr ( _, _) and
359
345
result = "loop bound"
360
346
or
361
347
this = TLoopStepIsMutatedVariableAccess ( _, _, _) and
362
348
result = "loop step"
363
349
or
364
- this = TLoopStepIsNonConstExpr ( _, _, _ ) and
350
+ this = TLoopStepIsNonConstExpr ( _, _) and
365
351
result = "loop step"
366
352
or
367
353
this = TLoopCounterIsTakenNonConstAddress ( _, _) and
@@ -391,14 +377,14 @@ class AlertType extends TAlertType {
391
377
this = TLoopCounterSmallerThanLoopBound ( _, _) and
392
378
result = "The $@ has a smaller type than that of the $@."
393
379
or
394
- this = TLoopBoundIsNonConstExpr ( _, _, _ ) and
395
- result = "The $@ is a non-const expression, or a variable that is $@ in the loop ."
380
+ this = TLoopBoundIsNonConstExpr ( _, _) and
381
+ result = "The $@ is a $@ ."
396
382
or
397
383
this = TLoopBoundIsMutatedVariableAccess ( _, _, _) and
398
384
result = "The $@ is a non-const expression, or a variable that is $@ in the loop."
399
385
or
400
- this = TLoopStepIsNonConstExpr ( _, _, _ ) and
401
- result = "The $@ is a non-const expression, or a variable that is $@ in the loop ."
386
+ this = TLoopStepIsNonConstExpr ( _, _) and
387
+ result = "The $@ is a $@ ."
402
388
or
403
389
this = TLoopStepIsMutatedVariableAccess ( _, _, _) and
404
390
result = "The $@ is a non-const expression, or a variable that is $@ in the loop."
@@ -425,11 +411,11 @@ class AlertType extends TAlertType {
425
411
result = forLoopCondition .getLoopBound ( )
426
412
)
427
413
or
428
- this = TLoopBoundIsNonConstExpr ( _, _ , result )
414
+ this = TLoopBoundIsNonConstExpr ( _, result )
429
415
or
430
416
this = TLoopBoundIsMutatedVariableAccess ( _, _, result )
431
417
or
432
- this = TLoopStepIsNonConstExpr ( _, _ , result )
418
+ this = TLoopStepIsNonConstExpr ( _, result )
433
419
or
434
420
this = TLoopStepIsMutatedVariableAccess ( _, _, result )
435
421
or
@@ -453,14 +439,14 @@ class AlertType extends TAlertType {
453
439
this = TLoopCounterSmallerThanLoopBound ( _, _) and
454
440
result = "loop bound"
455
441
or
456
- this = TLoopBoundIsNonConstExpr ( _, _, _ ) and
457
- result = "mutated "
442
+ this = TLoopBoundIsNonConstExpr ( _, _) and
443
+ result = "non-const expression "
458
444
or
459
445
this = TLoopBoundIsMutatedVariableAccess ( _, _, _) and
460
446
result = "mutated"
461
447
or
462
- this = TLoopStepIsNonConstExpr ( _, _, _ ) and
463
- result = "mutated "
448
+ this = TLoopStepIsNonConstExpr ( _, _) and
449
+ result = "non-const expression "
464
450
or
465
451
this = TLoopStepIsMutatedVariableAccess ( _, _, _) and
466
452
result = "mutated"
0 commit comments