@@ -52,28 +52,32 @@ abstract class TranslatedCall extends TranslatedExpr {
5252 resultType = getTypeForPRValue ( this .getCallResultType ( ) )
5353 }
5454
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+ )
6770 )
6871 or
6972 child = this .getSideEffects ( ) and
7073 if this .isNoReturn ( )
7174 then
75+ kind instanceof GotoEdge and
7276 result =
7377 any ( UnreachedInstruction instr |
7478 this .getEnclosingFunction ( ) .getFunction ( ) = instr .getEnclosingFunction ( )
7579 )
76- else result = this .getParent ( ) .getChildSuccessor ( this )
80+ else result = this .getParent ( ) .getChildSuccessor ( this , kind )
7781 }
7882
7983 override Instruction getInstructionSuccessor ( InstructionTag tag , EdgeKind kind ) {
@@ -203,12 +207,12 @@ abstract class TranslatedSideEffects extends TranslatedElement {
203207 )
204208 }
205209
206- final override Instruction getChildSuccessor ( TranslatedElement te ) {
210+ final override Instruction getChildSuccessor ( TranslatedElement te , EdgeKind kind ) {
207211 exists ( int i |
208212 this .getChild ( i ) = te and
209213 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 )
212216 )
213217 }
214218
@@ -220,7 +224,8 @@ abstract class TranslatedSideEffects extends TranslatedElement {
220224 result = this .getChild ( 0 ) .getFirstInstruction ( )
221225 or
222226 // 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 ) )
224229 }
225230
226231 final override Instruction getInstructionSuccessor ( InstructionTag tag , EdgeKind kind ) { none ( ) }
@@ -376,7 +381,7 @@ private int initializeAllocationGroup() { result = 3 }
376381abstract class TranslatedSideEffect extends TranslatedElement {
377382 final override TranslatedElement getChild ( int n ) { none ( ) }
378383
379- final override Instruction getChildSuccessor ( TranslatedElement child ) { none ( ) }
384+ final override Instruction getChildSuccessor ( TranslatedElement child , EdgeKind kind ) { none ( ) }
380385
381386 final override Instruction getFirstInstruction ( ) {
382387 result = this .getInstruction ( OnlyInstructionTag ( ) )
@@ -388,9 +393,8 @@ abstract class TranslatedSideEffect extends TranslatedElement {
388393 }
389394
390395 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 ( )
394398 }
395399
396400 final override Declaration getFunction ( ) { result = this .getParent ( ) .getFunction ( ) }
0 commit comments