@@ -7,9 +7,17 @@ private import TranslatedElement
77private import TranslatedExpr
88
99abstract class ConditionContext extends TranslatedElement {
10- abstract Instruction getChildTrueSuccessor ( TranslatedCondition child ) ;
11-
12- abstract Instruction getChildFalseSuccessor ( TranslatedCondition child ) ;
10+ /**
11+ * Gets the instruction to be executed when `child` evaluates to `true`. The
12+ * successor edge kind is specified by `kind`.
13+ */
14+ abstract Instruction getChildTrueSuccessor ( TranslatedCondition child , EdgeKind kind ) ;
15+
16+ /**
17+ * Gets the instruction to be executed when `child` evaluates to `false`. The
18+ * successor edge kind is specified by `kind`.
19+ */
20+ abstract Instruction getChildFalseSuccessor ( TranslatedCondition child , EdgeKind kind ) ;
1321}
1422
1523TranslatedCondition getTranslatedCondition ( Expr expr ) { result .getExpr ( ) = expr }
@@ -62,14 +70,14 @@ abstract class TranslatedFlexibleCondition extends TranslatedCondition, Conditio
6270class TranslatedParenthesisCondition extends TranslatedFlexibleCondition {
6371 override ParenthesisExpr expr ;
6472
65- final override Instruction getChildTrueSuccessor ( TranslatedCondition child ) {
73+ final override Instruction getChildTrueSuccessor ( TranslatedCondition child , EdgeKind kind ) {
6674 child = this .getOperand ( ) and
67- result = this .getConditionContext ( ) .getChildTrueSuccessor ( this )
75+ result = this .getConditionContext ( ) .getChildTrueSuccessor ( this , kind )
6876 }
6977
70- final override Instruction getChildFalseSuccessor ( TranslatedCondition child ) {
78+ final override Instruction getChildFalseSuccessor ( TranslatedCondition child , EdgeKind kind ) {
7179 child = this .getOperand ( ) and
72- result = this .getConditionContext ( ) .getChildFalseSuccessor ( this )
80+ result = this .getConditionContext ( ) .getChildFalseSuccessor ( this , kind )
7381 }
7482
7583 final override TranslatedCondition getOperand ( ) {
@@ -114,34 +122,34 @@ abstract class TranslatedBinaryLogicalOperation extends TranslatedNativeConditio
114122class TranslatedLogicalAndExpr extends TranslatedBinaryLogicalOperation {
115123 TranslatedLogicalAndExpr ( ) { expr instanceof LogicalAndExpr }
116124
117- override Instruction getChildTrueSuccessor ( TranslatedCondition child ) {
125+ override Instruction getChildTrueSuccessor ( TranslatedCondition child , EdgeKind kind ) {
118126 child = this .getLeftOperand ( ) and
119- result = this .getRightOperand ( ) .getFirstInstruction ( any ( GotoEdge edge ) )
127+ result = this .getRightOperand ( ) .getFirstInstruction ( kind )
120128 or
121129 child = this .getRightOperand ( ) and
122- result = this .getConditionContext ( ) .getChildTrueSuccessor ( this )
130+ result = this .getConditionContext ( ) .getChildTrueSuccessor ( this , kind )
123131 }
124132
125- override Instruction getChildFalseSuccessor ( TranslatedCondition child ) {
133+ override Instruction getChildFalseSuccessor ( TranslatedCondition child , EdgeKind kind ) {
126134 ( child = this .getLeftOperand ( ) or child = this .getRightOperand ( ) ) and
127- result = this .getConditionContext ( ) .getChildFalseSuccessor ( this )
135+ result = this .getConditionContext ( ) .getChildFalseSuccessor ( this , kind )
128136 }
129137}
130138
131139class TranslatedLogicalOrExpr extends TranslatedBinaryLogicalOperation {
132140 override LogicalOrExpr expr ;
133141
134- override Instruction getChildTrueSuccessor ( TranslatedCondition child ) {
142+ override Instruction getChildTrueSuccessor ( TranslatedCondition child , EdgeKind kind ) {
135143 ( child = this .getLeftOperand ( ) or child = this .getRightOperand ( ) ) and
136- result = this .getConditionContext ( ) .getChildTrueSuccessor ( this )
144+ result = this .getConditionContext ( ) .getChildTrueSuccessor ( this , kind )
137145 }
138146
139- override Instruction getChildFalseSuccessor ( TranslatedCondition child ) {
147+ override Instruction getChildFalseSuccessor ( TranslatedCondition child , EdgeKind kind ) {
140148 child = this .getLeftOperand ( ) and
141- result = this .getRightOperand ( ) .getFirstInstruction ( any ( GotoEdge edge ) )
149+ result = this .getRightOperand ( ) .getFirstInstruction ( kind )
142150 or
143151 child = this .getRightOperand ( ) and
144- result = this .getConditionContext ( ) .getChildFalseSuccessor ( this )
152+ result = this .getConditionContext ( ) .getChildFalseSuccessor ( this , kind )
145153 }
146154}
147155
@@ -170,10 +178,10 @@ class TranslatedValueCondition extends TranslatedCondition, TTranslatedValueCond
170178 tag = ValueConditionConditionalBranchTag ( ) and
171179 (
172180 kind instanceof TrueEdge and
173- result = this .getConditionContext ( ) .getChildTrueSuccessor ( this )
181+ result = this .getConditionContext ( ) .getChildTrueSuccessor ( this , any ( GotoEdge edge ) )
174182 or
175183 kind instanceof FalseEdge and
176- result = this .getConditionContext ( ) .getChildFalseSuccessor ( this )
184+ result = this .getConditionContext ( ) .getChildFalseSuccessor ( this , any ( GotoEdge edge ) )
177185 )
178186 }
179187
0 commit comments