Skip to content

Commit 388cb70

Browse files
committed
C#: Re-factor the CallSensitivityFlow test to use the new API.
1 parent eaddb62 commit 388cb70

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

csharp/ql/test/library-tests/dataflow/call-sensitivity/CallSensitivityFlow.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
*/
44

55
import csharp
6-
import DataFlow::PathGraph
6+
import CallSensitivity::PathGraph
77

8-
class Conf extends DataFlow::Configuration {
9-
Conf() { this = "CallSensitiveFlowConf" }
8+
module CallSensitivityConfig implements DataFlow::ConfigSig {
9+
predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
1010

11-
override predicate isSource(DataFlow::Node src) { src.asExpr() instanceof ObjectCreation }
12-
13-
override predicate isSink(DataFlow::Node sink) {
11+
predicate isSink(DataFlow::Node sink) {
1412
exists(MethodCall mc |
1513
mc.getTarget().hasName("Sink") and
1614
mc.getAnArgument() = sink.asExpr()
1715
)
1816
}
1917
}
2018

21-
from DataFlow::PathNode source, DataFlow::PathNode sink, Conf conf
22-
where conf.hasFlowPath(source, sink)
19+
module CallSensitivity = DataFlow::Global<CallSensitivityConfig>;
20+
21+
from CallSensitivity::PathNode source, CallSensitivity::PathNode sink
22+
where CallSensitivity::flowPath(source, sink)
2323
select source, source, sink, "$@", sink, sink.toString()

0 commit comments

Comments
 (0)