Skip to content

Commit 19914ab

Browse files
committed
C#: Remove CallableFlowSink.
1 parent ed4d09b commit 19914ab

File tree

1 file changed

+1
-81
lines changed

1 file changed

+1
-81
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -92,86 +92,6 @@ class CallableFlowSourceDelegateArg extends CallableFlowSource, TCallableFlowSou
9292
override Type getSourceType(Call c) { result = c.getArgument(i).getType() }
9393
}
9494

95-
private newtype TCallableFlowSink =
96-
TCallableFlowSinkQualifier() or
97-
TCallableFlowSinkReturn() or
98-
TCallableFlowSinkArg(int i) { exists(SourceDeclarationCallable c | exists(c.getParameter(i))) } or
99-
TCallableFlowSinkDelegateArg(int i, int j) { hasDelegateArgumentPosition2(_, i, j) }
100-
101-
/** A flow sink specification. */
102-
class CallableFlowSink extends TCallableFlowSink {
103-
/** Gets a textual representation of this flow sink specification. */
104-
string toString() { none() }
105-
106-
/** Gets the sink of flow for call `c`, if any. */
107-
Expr getSink(Call c) { none() }
108-
}
109-
110-
/** A flow sink specification: (method call) qualifier. */
111-
class CallableFlowSinkQualifier extends CallableFlowSink, TCallableFlowSinkQualifier {
112-
override string toString() { result = "qualifier" }
113-
114-
override Expr getSink(Call c) { result = c.getChild(-1) }
115-
}
116-
117-
/** A flow sink specification: return value. */
118-
class CallableFlowSinkReturn extends CallableFlowSink, TCallableFlowSinkReturn {
119-
override string toString() { result = "return" }
120-
121-
override Expr getSink(Call c) { result = c }
122-
}
123-
124-
/** A flow sink specification: (method call) argument. */
125-
class CallableFlowSinkArg extends CallableFlowSink, TCallableFlowSinkArg {
126-
private int i;
127-
128-
CallableFlowSinkArg() { this = TCallableFlowSinkArg(i) }
129-
130-
/** Gets the index of this `out`/`ref` argument. */
131-
int getArgumentIndex() { result = i }
132-
133-
/** Gets the `out`/`ref` argument of method call `mc` matching this specification. */
134-
Expr getArgument(MethodCall mc) {
135-
exists(Parameter p |
136-
p = mc.getTarget().getParameter(i) and
137-
p.isOutOrRef() and
138-
result = mc.getArgumentForParameter(p)
139-
)
140-
}
141-
142-
override string toString() { result = "argument " + i }
143-
144-
override Expr getSink(Call c) {
145-
// The uses of the `i`th argument are the actual sinks
146-
none()
147-
}
148-
}
149-
150-
/** A flow sink specification: parameter of a delegate argument. */
151-
class CallableFlowSinkDelegateArg extends CallableFlowSink, TCallableFlowSinkDelegateArg {
152-
private int delegateIndex;
153-
private int parameterIndex;
154-
155-
CallableFlowSinkDelegateArg() {
156-
this = TCallableFlowSinkDelegateArg(delegateIndex, parameterIndex)
157-
}
158-
159-
/** Gets the index of the delegate argument. */
160-
int getDelegateIndex() { result = delegateIndex }
161-
162-
/** Gets the index of the delegate parameter. */
163-
int getDelegateParameterIndex() { result = parameterIndex }
164-
165-
override string toString() {
166-
result = "parameter " + parameterIndex + " of argument " + delegateIndex
167-
}
168-
169-
override Expr getSink(Call c) {
170-
// The uses of the `j`th parameter are the actual sinks
171-
none()
172-
}
173-
}
174-
17595
/** A specification of data flow for a library (non-source code) type. */
17696
abstract class LibraryTypeDataFlow extends Type {
17797
LibraryTypeDataFlow() { this = this.getUnboundDeclaration() }
@@ -231,7 +151,7 @@ private module FrameworkDataFlowAdaptor {
231151
this = SummaryComponentStack::singleton(SummaryComponent::argument(i))
232152
)
233153
or
234-
exists(int i, int j | exists(TCallableFlowSinkDelegateArg(i, j)) |
154+
exists(int i, int j | hasDelegateArgumentPosition2(_, i, j) |
235155
head = SummaryComponent::parameter(j) and
236156
this = SummaryComponentStack::singleton(SummaryComponent::argument(i))
237157
)

0 commit comments

Comments
 (0)