11import cpp
22import semmle.code.cpp.ir.dataflow.DataFlow
33
4- class TestConfig extends DataFlow:: Configuration {
5- TestConfig ( ) { this = "TestConfig" }
6-
7- override predicate isSource ( DataFlow:: Node source ) {
4+ module TestConfig implements DataFlow:: ConfigSig {
5+ predicate isSource ( DataFlow:: Node source ) {
86 source .asExpr ( ) .( FunctionCall ) .getTarget ( ) .getName ( ) = "source"
97 }
108
11- override predicate isSink ( DataFlow:: Node sink ) {
9+ predicate isSink ( DataFlow:: Node sink ) {
1210 exists ( FunctionCall call |
1311 call .getTarget ( ) .getName ( ) = "sink" and
1412 sink .asExpr ( ) = call .getAnArgument ( )
1513 )
1614 }
1715
18- override predicate isAdditionalFlowStep ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
16+ predicate isAdditionalFlowStep ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
1917 // Send all arguments of function-pointer-calls to a function with a
2018 // special name
2119 exists ( Call call , Function target , int i |
@@ -27,6 +25,8 @@ class TestConfig extends DataFlow::Configuration {
2725 }
2826}
2927
30- from DataFlow:: Node sink , DataFlow:: Node source , TestConfig cfg
31- where cfg .hasFlow ( source , sink )
28+ module TestFlow = DataFlow:: Make< TestConfig > ;
29+
30+ from DataFlow:: Node sink , DataFlow:: Node source
31+ where TestFlow:: hasFlow ( source , sink )
3232select sink , source
0 commit comments