@@ -23,6 +23,14 @@ private newtype TFunctionInput =
23
23
class FunctionInput extends TFunctionInput {
24
24
abstract string toString ( ) ;
25
25
26
+ /**
27
+ * INTERNAL: Do not use.
28
+ *
29
+ * Gets the `FunctionInput` that represents the indirection of this input,
30
+ * if any.
31
+ */
32
+ FunctionInput getIndirectionInput ( ) { none ( ) }
33
+
26
34
/**
27
35
* Holds if this is the input value of the parameter with index `index`.
28
36
*
@@ -226,6 +234,8 @@ class InParameter extends FunctionInput, TInParameter {
226
234
ParameterIndex getIndex ( ) { result = index }
227
235
228
236
override predicate isParameter ( ParameterIndex i ) { i = index }
237
+
238
+ override FunctionInput getIndirectionInput ( ) { result = TInParameterDeref ( index , 1 ) }
229
239
}
230
240
231
241
/**
@@ -257,6 +267,10 @@ class InParameterDeref extends FunctionInput, TInParameterDeref {
257
267
override predicate isParameterDeref ( ParameterIndex i , int indirection ) {
258
268
i = index and indirectionIndex = indirection
259
269
}
270
+
271
+ override FunctionInput getIndirectionInput ( ) {
272
+ result = TInParameterDeref ( index , indirectionIndex + 1 )
273
+ }
260
274
}
261
275
262
276
/**
@@ -275,6 +289,8 @@ class InQualifierObject extends FunctionInput, TInQualifierObject {
275
289
override string toString ( ) { result = "InQualifierObject" }
276
290
277
291
override predicate isQualifierObject ( ) { any ( ) }
292
+
293
+ override FunctionInput getIndirectionInput ( ) { none ( ) }
278
294
}
279
295
280
296
/**
@@ -293,6 +309,8 @@ class InQualifierAddress extends FunctionInput, TInQualifierAddress {
293
309
override string toString ( ) { result = "InQualifierAddress" }
294
310
295
311
override predicate isQualifierAddress ( ) { any ( ) }
312
+
313
+ override FunctionInput getIndirectionInput ( ) { result = TInQualifierObject ( ) }
296
314
}
297
315
298
316
/**
@@ -321,6 +339,8 @@ class InReturnValueDeref extends FunctionInput, TInReturnValueDeref {
321
339
override string toString ( ) { result = "InReturnValueDeref" }
322
340
323
341
override predicate isReturnValueDeref ( ) { any ( ) }
342
+
343
+ override FunctionInput getIndirectionInput ( ) { none ( ) }
324
344
}
325
345
326
346
private newtype TFunctionOutput =
@@ -340,6 +360,14 @@ private newtype TFunctionOutput =
340
360
class FunctionOutput extends TFunctionOutput {
341
361
abstract string toString ( ) ;
342
362
363
+ /**
364
+ * INTERNAL: Do not use.
365
+ *
366
+ * Gets the `FunctionOutput` that represents the indirection of this output,
367
+ * if any.
368
+ */
369
+ FunctionOutput getIndirectionOutput ( ) { none ( ) }
370
+
343
371
/**
344
372
* Holds if this is the output value pointed to by a pointer parameter to a function, or the
345
373
* output value referred to by a reference parameter to a function, where the parameter has
@@ -512,6 +540,10 @@ class OutParameterDeref extends FunctionOutput, TOutParameterDeref {
512
540
override predicate isParameterDeref ( ParameterIndex i , int ind ) {
513
541
i = index and ind = indirectionIndex
514
542
}
543
+
544
+ override FunctionOutput getIndirectionOutput ( ) {
545
+ result = TOutParameterDeref ( index , indirectionIndex + 1 )
546
+ }
515
547
}
516
548
517
549
/**
@@ -530,6 +562,8 @@ class OutQualifierObject extends FunctionOutput, TOutQualifierObject {
530
562
override string toString ( ) { result = "OutQualifierObject" }
531
563
532
564
override predicate isQualifierObject ( ) { any ( ) }
565
+
566
+ override FunctionOutput getIndirectionOutput ( ) { none ( ) }
533
567
}
534
568
535
569
/**
@@ -552,6 +586,8 @@ class OutReturnValue extends FunctionOutput, TOutReturnValue {
552
586
override string toString ( ) { result = "OutReturnValue" }
553
587
554
588
override predicate isReturnValue ( ) { any ( ) }
589
+
590
+ override FunctionOutput getIndirectionOutput ( ) { result = TOutReturnValueDeref ( 1 ) }
555
591
}
556
592
557
593
/**
@@ -571,11 +607,19 @@ class OutReturnValue extends FunctionOutput, TOutReturnValue {
571
607
* of `getInt()` is neither a pointer nor a reference.
572
608
*/
573
609
class OutReturnValueDeref extends FunctionOutput , TOutReturnValueDeref {
610
+ int indirectionIndex ;
611
+
612
+ OutReturnValueDeref ( ) { this = TOutReturnValueDeref ( indirectionIndex ) }
613
+
574
614
override string toString ( ) { result = "OutReturnValueDeref" }
575
615
576
616
override predicate isReturnValueDeref ( ) { any ( ) }
577
617
578
- override predicate isReturnValueDeref ( int indirectionIndex ) {
579
- this = TOutReturnValueDeref ( indirectionIndex )
618
+ override predicate isReturnValueDeref ( int indirectionIndex_ ) {
619
+ indirectionIndex = indirectionIndex_
620
+ }
621
+
622
+ override FunctionOutput getIndirectionOutput ( ) {
623
+ result = TOutReturnValueDeref ( indirectionIndex + 1 )
580
624
}
581
625
}
0 commit comments