@@ -2,13 +2,6 @@ import semmle.code.cpp.exprs.Expr
22import semmle.code.cpp.Function
33private import semmle.code.cpp.dataflow.EscapesTree
44
5- /**
6- * Gets the index of the `...` parameter, if any.
7- */
8- private int getEllipsisParameterIndex ( RoutineType type ) {
9- type .getParameterType ( result ) instanceof UnknownType
10- }
11-
125/**
136 * A C/C++ call.
147 *
@@ -85,32 +78,6 @@ abstract class Call extends Expr, NameQualifiableElement {
8578
8679 override string toString ( ) { none ( ) }
8780
88- /**
89- * Gets the index of the `...` parameter, if any. This will be one greater than the index of the
90- * last declared positional parameter.
91- */
92- abstract int getEllipsisParameterIndex ( ) ;
93-
94- /**
95- * Gets the index of the parameter that will be initialized with the value of the argument
96- * specified by `argIndex`. For ordinary positional parameters, the argument and parameter indices
97- * will be equal. For a call to a varargs function, all arguments passed to the `...` will be
98- * mapped to the index returned by `getEllipsisParameterIndex()`.
99- */
100- final int getParameterIndexForArgument ( int argIndex ) {
101- exists ( getArgument ( argIndex ) ) and
102- if argIndex >= getEllipsisParameterIndex ( )
103- then result = getEllipsisParameterIndex ( )
104- else result = argIndex
105- }
106-
107- /**
108- * Holds if the argument specified by `index` is an argument to the `...` of a varargs function.
109- */
110- final predicate isEllipsisArgumentIndex ( int index ) {
111- exists ( getArgument ( index ) ) and index >= getEllipsisParameterIndex ( )
112- }
113-
11481 /**
11582 * Holds if this call passes the variable accessed by `va` by
11683 * reference as the `i`th argument.
@@ -229,7 +196,7 @@ class FunctionCall extends Call, @funbindexpr {
229196 * constructor calls, this predicate instead gets the `Class` of the constructor
230197 * being called.
231198 */
232- private Type getTargetType ( ) { result = Call .super .getType ( ) .stripType ( ) }
199+ Type getTargetType ( ) { result = Call .super .getType ( ) .stripType ( ) }
233200
234201 /**
235202 * Gets the expected return type of the function called by this call.
@@ -292,12 +259,6 @@ class FunctionCall extends Call, @funbindexpr {
292259 else result = "call to unknown function"
293260 }
294261
295- final override int getEllipsisParameterIndex ( ) {
296- if getTargetType ( ) instanceof RoutineType
297- then result = getEllipsisParameterIndex ( getTargetType ( ) )
298- else result = getTarget ( ) .getEllipsisParameterIndex ( )
299- }
300-
301262 override predicate mayBeImpure ( ) {
302263 this .getChild ( _) .mayBeImpure ( ) or
303264 this .getTarget ( ) .mayHaveSideEffects ( ) or
@@ -417,10 +378,6 @@ class ExprCall extends Call, @callexpr {
417378 override string toString ( ) { result = "call to expression" }
418379
419380 override Function getTarget ( ) { none ( ) }
420-
421- final override int getEllipsisParameterIndex ( ) {
422- result = getEllipsisParameterIndex ( getExpr ( ) .getType ( ) .stripType ( ) )
423- }
424381}
425382
426383/**
0 commit comments