@@ -52,28 +52,32 @@ abstract class TranslatedCall extends TranslatedExpr {
52
52
resultType = getTypeForPRValue ( this .getCallResultType ( ) )
53
53
}
54
54
55
- override Instruction getChildSuccessor ( TranslatedElement child ) {
56
- child = this .getQualifier ( ) and
57
- result = this .getFirstCallTargetInstruction ( )
58
- or
59
- child = this .getCallTarget ( ) and
60
- result = this .getFirstArgumentOrCallInstruction ( )
61
- or
62
- exists ( int argIndex |
63
- child = this .getArgument ( argIndex ) and
64
- if exists ( this .getArgument ( argIndex + 1 ) )
65
- then result = this .getArgument ( argIndex + 1 ) .getFirstInstruction ( )
66
- else result = this .getInstruction ( CallTag ( ) )
55
+ override Instruction getChildSuccessor ( TranslatedElement child , EdgeKind kind ) {
56
+ kind instanceof GotoEdge and
57
+ (
58
+ child = this .getQualifier ( ) and
59
+ result = this .getFirstCallTargetInstruction ( )
60
+ or
61
+ child = this .getCallTarget ( ) and
62
+ result = this .getFirstArgumentOrCallInstruction ( )
63
+ or
64
+ exists ( int argIndex |
65
+ child = this .getArgument ( argIndex ) and
66
+ if exists ( this .getArgument ( argIndex + 1 ) )
67
+ then result = this .getArgument ( argIndex + 1 ) .getFirstInstruction ( )
68
+ else result = this .getInstruction ( CallTag ( ) )
69
+ )
67
70
)
68
71
or
69
72
child = this .getSideEffects ( ) and
70
73
if this .isNoReturn ( )
71
74
then
75
+ kind instanceof GotoEdge and
72
76
result =
73
77
any ( UnreachedInstruction instr |
74
78
this .getEnclosingFunction ( ) .getFunction ( ) = instr .getEnclosingFunction ( )
75
79
)
76
- else result = this .getParent ( ) .getChildSuccessor ( this )
80
+ else result = this .getParent ( ) .getChildSuccessor ( this , kind )
77
81
}
78
82
79
83
override Instruction getInstructionSuccessor ( InstructionTag tag , EdgeKind kind ) {
@@ -203,12 +207,12 @@ abstract class TranslatedSideEffects extends TranslatedElement {
203
207
)
204
208
}
205
209
206
- final override Instruction getChildSuccessor ( TranslatedElement te ) {
210
+ final override Instruction getChildSuccessor ( TranslatedElement te , EdgeKind kind ) {
207
211
exists ( int i |
208
212
this .getChild ( i ) = te and
209
213
if exists ( this .getChild ( i + 1 ) )
210
- then result = this .getChild ( i + 1 ) .getFirstInstruction ( )
211
- else result = this .getParent ( ) .getChildSuccessor ( this )
214
+ then kind instanceof GotoEdge and result = this .getChild ( i + 1 ) .getFirstInstruction ( )
215
+ else result = this .getParent ( ) .getChildSuccessor ( this , kind )
212
216
)
213
217
}
214
218
@@ -220,7 +224,8 @@ abstract class TranslatedSideEffects extends TranslatedElement {
220
224
result = this .getChild ( 0 ) .getFirstInstruction ( )
221
225
or
222
226
// Some functions, like `std::move()`, have no side effects whatsoever.
223
- not exists ( this .getChild ( 0 ) ) and result = this .getParent ( ) .getChildSuccessor ( this )
227
+ not exists ( this .getChild ( 0 ) ) and
228
+ result = this .getParent ( ) .getChildSuccessor ( this , any ( GotoEdge edge ) )
224
229
}
225
230
226
231
final override Instruction getInstructionSuccessor ( InstructionTag tag , EdgeKind kind ) { none ( ) }
@@ -376,7 +381,7 @@ private int initializeAllocationGroup() { result = 3 }
376
381
abstract class TranslatedSideEffect extends TranslatedElement {
377
382
final override TranslatedElement getChild ( int n ) { none ( ) }
378
383
379
- final override Instruction getChildSuccessor ( TranslatedElement child ) { none ( ) }
384
+ final override Instruction getChildSuccessor ( TranslatedElement child , EdgeKind kind ) { none ( ) }
380
385
381
386
final override Instruction getFirstInstruction ( ) {
382
387
result = this .getInstruction ( OnlyInstructionTag ( ) )
@@ -388,9 +393,8 @@ abstract class TranslatedSideEffect extends TranslatedElement {
388
393
}
389
394
390
395
final override Instruction getInstructionSuccessor ( InstructionTag tag , EdgeKind kind ) {
391
- result = this .getParent ( ) .getChildSuccessor ( this ) and
392
- tag = OnlyInstructionTag ( ) and
393
- kind instanceof GotoEdge
396
+ result = this .getParent ( ) .getChildSuccessor ( this , kind ) and
397
+ tag = OnlyInstructionTag ( )
394
398
}
395
399
396
400
final override Declaration getFunction ( ) { result = this .getParent ( ) .getFunction ( ) }
0 commit comments