@@ -8,7 +8,7 @@ import semmle.code.cpp.Parameter
88
99private newtype TFunctionInput =
1010 TInParameter ( ParameterIndex i ) or
11- TInParameterDeref ( ParameterIndex i ) or
11+ TInParameterDeref ( ParameterIndex i , int indirectionIndex ) { indirectionIndex = [ 1 , 2 ] } or
1212 TInQualifierObject ( ) or
1313 TInQualifierAddress ( ) or
1414 TInReturnValueDeref ( )
@@ -245,15 +245,18 @@ class InParameter extends FunctionInput, TInParameter {
245245 */
246246class InParameterDeref extends FunctionInput , TInParameterDeref {
247247 ParameterIndex index ;
248+ int indirectionIndex ;
248249
249- InParameterDeref ( ) { this = TInParameterDeref ( index ) }
250+ InParameterDeref ( ) { this = TInParameterDeref ( index , indirectionIndex ) }
250251
251252 override string toString ( ) { result = "InParameterDeref " + index .toString ( ) }
252253
253254 /** Gets the zero-based index of the parameter. */
254255 ParameterIndex getIndex ( ) { result = index }
255256
256- override predicate isParameterDeref ( ParameterIndex i ) { i = index }
257+ override predicate isParameterDeref ( ParameterIndex i , int indirection ) {
258+ i = index and indirectionIndex = indirection
259+ }
257260}
258261
259262/**
@@ -321,10 +324,10 @@ class InReturnValueDeref extends FunctionInput, TInReturnValueDeref {
321324}
322325
323326private newtype TFunctionOutput =
324- TOutParameterDeref ( ParameterIndex i ) or
327+ TOutParameterDeref ( ParameterIndex i , int indirectionIndex ) { indirectionIndex = [ 1 , 2 ] } or
325328 TOutQualifierObject ( ) or
326329 TOutReturnValue ( ) or
327- TOutReturnValueDeref ( )
330+ TOutReturnValueDeref ( int indirections ) { indirections = [ 1 , 2 ] }
328331
329332/**
330333 * An output from a function. This can be:
@@ -498,17 +501,16 @@ class FunctionOutput extends TFunctionOutput {
498501 */
499502class OutParameterDeref extends FunctionOutput , TOutParameterDeref {
500503 ParameterIndex index ;
504+ int indirectionIndex ;
501505
502- OutParameterDeref ( ) { this = TOutParameterDeref ( index ) }
506+ OutParameterDeref ( ) { this = TOutParameterDeref ( index , indirectionIndex ) }
503507
504508 override string toString ( ) { result = "OutParameterDeref " + index .toString ( ) }
505509
506510 ParameterIndex getIndex ( ) { result = index }
507511
508- override predicate isParameterDeref ( ParameterIndex i ) { i = index }
509-
510512 override predicate isParameterDeref ( ParameterIndex i , int ind ) {
511- this . isParameterDeref ( i ) and ind = 1
513+ i = index and ind = indirectionIndex
512514 }
513515}
514516
@@ -572,4 +574,8 @@ class OutReturnValueDeref extends FunctionOutput, TOutReturnValueDeref {
572574 override string toString ( ) { result = "OutReturnValueDeref" }
573575
574576 override predicate isReturnValueDeref ( ) { any ( ) }
577+
578+ override predicate isReturnValueDeref ( int indirectionIndex ) {
579+ this = TOutReturnValueDeref ( indirectionIndex )
580+ }
575581}
0 commit comments