@@ -404,6 +404,19 @@ abstract class TranslatedReturnStmt extends TranslatedStmt {
404
404
final TranslatedFunction getEnclosingFunction ( ) {
405
405
result = getTranslatedFunction ( stmt .getEnclosingFunction ( ) )
406
406
}
407
+
408
+ override Instruction getChildSuccessorInternal ( TranslatedElement child , EdgeKind kind ) {
409
+ exists ( int id |
410
+ child = this .getChild ( id ) and
411
+ id >= this .getFirstDestructorCallIndex ( ) and
412
+ (
413
+ result = this .getChild ( id + 1 ) .getFirstInstruction ( kind )
414
+ or
415
+ not exists ( this .getChild ( id + 1 ) ) and
416
+ result = this .getEnclosingFunction ( ) .getReturnSuccessorInstruction ( kind )
417
+ )
418
+ )
419
+ }
407
420
}
408
421
409
422
/**
@@ -421,15 +434,7 @@ class TranslatedReturnValueStmt extends TranslatedReturnStmt, TranslatedVariable
421
434
override Instruction getChildSuccessorInternal ( TranslatedElement child , EdgeKind kind ) {
422
435
result = TranslatedVariableInitialization .super .getChildSuccessorInternal ( child , kind )
423
436
or
424
- exists ( int id |
425
- this .getChild ( id ) = child and
426
- (
427
- result = this .getChild ( id + 1 ) .getFirstInstruction ( kind )
428
- or
429
- not exists ( this .getChild ( id + 1 ) ) and
430
- result = this .getEnclosingFunction ( ) .getReturnSuccessorInstruction ( kind )
431
- )
432
- )
437
+ result = TranslatedReturnStmt .super .getChildSuccessorInternal ( child , kind )
433
438
}
434
439
435
440
final override TranslatedElement getChildInternal ( int id ) {
@@ -491,19 +496,7 @@ class TranslatedReturnVoidExpressionStmt extends TranslatedReturnStmt {
491
496
result = this .getInstruction ( OnlyInstructionTag ( ) ) and
492
497
kind instanceof GotoEdge
493
498
or
494
- exists ( int id |
495
- child = this .getChild ( id ) and
496
- id >= this .getFirstDestructorCallIndex ( ) and
497
- result = this .getChild ( id + 1 ) .getFirstInstruction ( kind )
498
- )
499
- or
500
- exists ( int id |
501
- child = this .getChild ( id ) and
502
- id >= this .getFirstDestructorCallIndex ( ) and
503
- exists ( this .getChild ( id ) ) and
504
- not exists ( this .getChild ( id + 1 ) ) and
505
- result = this .getEnclosingFunction ( ) .getReturnSuccessorInstruction ( kind )
506
- )
499
+ result = TranslatedReturnStmt .super .getChildSuccessorInternal ( child , kind )
507
500
}
508
501
509
502
private TranslatedExpr getExpr ( ) { result = getTranslatedExpr ( stmt .getExpr ( ) ) }
@@ -580,13 +573,21 @@ class TranslatedNoValueReturnStmt extends TranslatedReturnStmt, TranslatedVariab
580
573
result = TranslatedVariableInitialization .super .getChildInternal ( id )
581
574
}
582
575
576
+ override Instruction getChildSuccessorInternal ( TranslatedElement child , EdgeKind kind ) {
577
+ result = TranslatedVariableInitialization .super .getChildSuccessorInternal ( child , kind )
578
+ or
579
+ result = TranslatedReturnStmt .super .getChildSuccessorInternal ( child , kind )
580
+ }
581
+
583
582
final override Type getTargetType ( ) { result = this .getEnclosingFunction ( ) .getReturnType ( ) }
584
583
585
584
final override TranslatedInitialization getInitialization ( ) { none ( ) }
586
585
587
586
final override IRVariable getIRVariable ( ) {
588
587
result = this .getEnclosingFunction ( ) .getReturnVariable ( )
589
588
}
589
+
590
+ override predicate handlesDestructorsExplicitly ( ) { any ( ) }
590
591
}
591
592
592
593
/**
0 commit comments