@@ -18,17 +18,16 @@ abstract class TranslatedCall extends TranslatedExpr {
1818 // The qualifier is evaluated before the call target, because the value of
1919 // the call target may depend on the value of the qualifier for virtual
2020 // calls.
21- id = - 2 and result = getQualifier ( )
22- or
23- id = - 1 and result = getCallTarget ( )
24- or
25- result = getArgument ( id )
21+ id = - 2 and result = this .getQualifier ( ) or
22+ id = - 1 and result = this .getCallTarget ( ) or
23+ result = this .getArgument ( id )
2624 }
2725
28- final override Instruction getFirstInstruction ( ) {
29- if exists ( getQualifier ( ) )
30- then result = getQualifier ( ) .getFirstInstruction ( )
31- else result = getFirstCallTargetInstruction ( )
26+ override final Instruction getFirstInstruction ( ) {
27+ if exists ( this .getQualifier ( ) ) then
28+ result = this .getQualifier ( ) .getFirstInstruction ( )
29+ else
30+ result = this .getFirstCallTargetInstruction ( )
3231 }
3332
3433 override predicate hasInstruction (
@@ -60,20 +59,19 @@ abstract class TranslatedCall extends TranslatedExpr {
6059
6160 override Instruction getChildSuccessor ( TranslatedElement child ) {
6261 (
63- child = getQualifier ( ) and
64- result = getFirstCallTargetInstruction ( )
65- )
66- or
62+ child = this .getQualifier ( ) and
63+ result = this .getFirstCallTargetInstruction ( )
64+ ) or
6765 (
68- child = getCallTarget ( ) and
69- result = getFirstArgumentOrCallInstruction ( )
70- )
71- or
66+ child = this .getCallTarget ( ) and
67+ result = this .getFirstArgumentOrCallInstruction ( )
68+ ) or
7269 exists ( int argIndex |
73- child = getArgument ( argIndex ) and
74- if exists ( getArgument ( argIndex + 1 ) )
75- then result = getArgument ( argIndex + 1 ) .getFirstInstruction ( )
76- else result = getInstruction ( CallTag ( ) )
70+ child = this .getArgument ( argIndex ) and
71+ if exists ( this .getArgument ( argIndex + 1 ) ) then
72+ result = this .getArgument ( argIndex + 1 ) .getFirstInstruction ( )
73+ else
74+ result = this .getInstruction ( CallTag ( ) )
7775 )
7876 }
7977
@@ -82,32 +80,43 @@ abstract class TranslatedCall extends TranslatedExpr {
8280 (
8381 (
8482 tag = CallTag ( ) and
85- if hasSideEffect ( )
86- then result = getInstruction ( CallSideEffectTag ( ) )
87- else result = getParent ( ) . getChildSuccessor ( this )
88- )
89- or
83+ if this . hasSideEffect ( ) then
84+ result = this . getInstruction ( CallSideEffectTag ( ) )
85+ else
86+ result = this . getParent ( ) . getChildSuccessor ( this )
87+ ) or
9088 (
91- hasSideEffect ( ) and
89+ this . hasSideEffect ( ) and
9290 tag = CallSideEffectTag ( ) and
93- result = getParent ( ) .getChildSuccessor ( this )
91+ result = this . getParent ( ) .getChildSuccessor ( this )
9492 )
9593 )
9694 }
9795
9896 override Instruction getInstructionOperand ( InstructionTag tag , OperandTag operandTag ) {
9997 tag = CallTag ( ) and
10098 (
101- operandTag instanceof CallTargetOperandTag and
102- result = getCallTargetResult ( )
103- or
104- operandTag instanceof ThisArgumentOperandTag and
105- result = getQualifierResult ( )
106- or
107- exists ( PositionalArgumentOperandTag argTag |
108- argTag = operandTag and
109- result = getArgument ( argTag .getArgIndex ( ) ) .getResult ( )
99+ tag = CallTag ( ) and
100+ (
101+ (
102+ operandTag instanceof CallTargetOperandTag and
103+ result = this .getCallTargetResult ( )
104+ ) or
105+ (
106+ operandTag instanceof ThisArgumentOperandTag and
107+ result = this .getQualifierResult ( )
108+ ) or
109+ exists ( PositionalArgumentOperandTag argTag |
110+ argTag = operandTag and
111+ result = this .getArgument ( argTag .getArgIndex ( ) ) .getResult ( )
112+ )
110113 )
114+ ) or
115+ (
116+ tag = CallSideEffectTag ( ) and
117+ this .hasSideEffect ( ) and
118+ operandTag instanceof SideEffectOperandTag and
119+ result = this .getEnclosingFunction ( ) .getUnmodeledDefinitionInstruction ( )
111120 )
112121 or
113122 tag = CallSideEffectTag ( ) and
@@ -118,12 +127,14 @@ abstract class TranslatedCall extends TranslatedExpr {
118127
119128 final override Type getInstructionOperandType ( InstructionTag tag , TypedOperandTag operandTag ) {
120129 tag = CallSideEffectTag ( ) and
121- hasSideEffect ( ) and
130+ this . hasSideEffect ( ) and
122131 operandTag instanceof SideEffectOperandTag and
123132 result instanceof Language:: UnknownType
124133 }
125134
126- final override Instruction getResult ( ) { result = getInstruction ( CallTag ( ) ) }
135+ override final Instruction getResult ( ) {
136+ result = this .getInstruction ( CallTag ( ) )
137+ }
127138
128139 /**
129140 * Gets the result type of the call.
@@ -133,7 +144,9 @@ abstract class TranslatedCall extends TranslatedExpr {
133144 /**
134145 * Holds if the call has a `this` argument.
135146 */
136- predicate hasQualifier ( ) { exists ( getQualifier ( ) ) }
147+ predicate hasQualifier ( ) {
148+ exists ( this .getQualifier ( ) )
149+ }
137150
138151 /**
139152 * Gets the `TranslatedExpr` for the indirect target of the call, if any.
@@ -146,15 +159,19 @@ abstract class TranslatedCall extends TranslatedExpr {
146159 * it can be overridden by a subclass for cases where there is a call target
147160 * that is not computed from an expression (e.g. a direct call).
148161 */
149- Instruction getFirstCallTargetInstruction ( ) { result = getCallTarget ( ) .getFirstInstruction ( ) }
162+ Instruction getFirstCallTargetInstruction ( ) {
163+ result = this .getCallTarget ( ) .getFirstInstruction ( )
164+ }
150165
151166 /**
152167 * Gets the instruction whose result value is the target of the call. By
153168 * default, this is just the result of `getCallTarget()`, but it can be
154169 * overridden by a subclass for cases where there is a call target that is not
155170 * computed from an expression (e.g. a direct call).
156171 */
157- Instruction getCallTargetResult ( ) { result = getCallTarget ( ) .getResult ( ) }
172+ Instruction getCallTargetResult ( ) {
173+ result = this .getCallTarget ( ) .getResult ( )
174+ }
158175
159176 /**
160177 * Gets the `TranslatedExpr` for the qualifier of the call (i.e. the value
@@ -168,7 +185,9 @@ abstract class TranslatedCall extends TranslatedExpr {
168185 * overridden by a subclass for cases where there is a `this` argument that is
169186 * not computed from a child expression (e.g. a constructor call).
170187 */
171- Instruction getQualifierResult ( ) { result = getQualifier ( ) .getResult ( ) }
188+ Instruction getQualifierResult ( ) {
189+ result = this .getQualifier ( ) .getResult ( )
190+ }
172191
173192 /**
174193 * Gets the argument with the specified `index`. Does not include the `this`
@@ -181,9 +200,10 @@ abstract class TranslatedCall extends TranslatedExpr {
181200 * argument. Otherwise, returns the call instruction.
182201 */
183202 final Instruction getFirstArgumentOrCallInstruction ( ) {
184- if hasArguments ( )
185- then result = getArgument ( 0 ) .getFirstInstruction ( )
186- else result = getInstruction ( CallTag ( ) )
203+ if this .hasArguments ( ) then
204+ result = this .getArgument ( 0 ) .getFirstInstruction ( )
205+ else
206+ result = this .getInstruction ( CallTag ( ) )
187207 }
188208
189209 /**
@@ -199,9 +219,9 @@ abstract class TranslatedCall extends TranslatedExpr {
199219 private predicate hasSideEffect ( ) { hasReadSideEffect ( ) or hasWriteSideEffect ( ) }
200220
201221 override Instruction getPrimaryInstructionForSideEffect ( InstructionTag tag ) {
202- hasSideEffect ( ) and
203- tag = CallSideEffectTag ( ) and
204- result = getResult ( )
222+ this . hasSideEffect ( ) and
223+ tag = CallSideEffectTag ( ) and
224+ result = this . getResult ( )
205225 }
206226}
207227
@@ -211,10 +231,10 @@ abstract class TranslatedCall extends TranslatedExpr {
211231 */
212232abstract class TranslatedDirectCall extends TranslatedCall {
213233 final override Instruction getFirstCallTargetInstruction ( ) {
214- result = getInstruction ( CallTargetTag ( ) )
234+ result = this . getInstruction ( CallTargetTag ( ) )
215235 }
216236
217- final override Instruction getCallTargetResult ( ) { result = getInstruction ( CallTargetTag ( ) ) }
237+ final override Instruction getCallTargetResult ( ) { result = this . getInstruction ( CallTargetTag ( ) ) }
218238
219239 override predicate hasInstruction (
220240 Opcode opcode , InstructionTag tag , Type resultType , boolean isLValue
@@ -232,7 +252,7 @@ abstract class TranslatedDirectCall extends TranslatedCall {
232252 or
233253 tag = CallTargetTag ( ) and
234254 kind instanceof GotoEdge and
235- result = getFirstArgumentOrCallInstruction ( )
255+ result = this . getFirstArgumentOrCallInstruction ( )
236256 }
237257}
238258
@@ -242,7 +262,7 @@ abstract class TranslatedDirectCall extends TranslatedCall {
242262abstract class TranslatedCallExpr extends TranslatedNonConstantExpr , TranslatedCall {
243263 override Call expr ;
244264
245- override Type getCallResultType ( ) { result = getResultType ( ) }
265+ override Type getCallResultType ( ) { result = this . getResultType ( ) }
246266
247267 final override predicate hasArguments ( ) { exists ( expr .getArgument ( 0 ) ) }
248268
@@ -290,7 +310,7 @@ class TranslatedConstructorCall extends TranslatedFunctionCall {
290310 // We must retrieve the qualifier from the context the
291311 // constructor call happened
292312 exists ( StructorCallContext context |
293- context = getParent ( ) and
313+ context = this . getParent ( ) and
294314 result = context .getReceiver ( )
295315 )
296316 }
0 commit comments