Skip to content

Commit 4fe4315

Browse files
committed
QL: QL: Add dataflow library.
1 parent 4238a5b commit 4fe4315

7 files changed

Lines changed: 6591 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Provides a library for local (intra-procedural) and global (inter-procedural)
3+
* data flow analysis: deciding whether data can flow from a _source_ to a
4+
* _sink_.
5+
*
6+
* Unless configured otherwise, _flow_ means that the exact value of
7+
* the source may reach the sink. We do not track flow across pointer
8+
* dereferences or array indexing. To track these types of flow, where the
9+
* exact value may not be preserved, import
10+
* `semmle.code.cpp.dataflow.TaintTracking`.
11+
*
12+
* To use global (interprocedural) data flow, extend the class
13+
* `DataFlow::Configuration` as documented on that class. To use local
14+
* (intraprocedural) data flow between expressions, call
15+
* `DataFlow::localExprFlow`. For more general cases of local data flow, call
16+
* `DataFlow::localFlow` or `DataFlow::localFlowStep` with arguments of type
17+
* `DataFlow::Node`.
18+
*/
19+
20+
import ql
21+
22+
module DataFlow {
23+
import internal.DataFlowImpl
24+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
private import ql
2+
private import DataFlowUtil
3+
4+
/**
5+
* Gets a function that might be called by `call`.
6+
*/
7+
DataFlowCallable viableCallable(Call call) { result.asPredicate() = call.getTarget() }
8+
9+
/**
10+
* Holds if the set of viable implementations that can be called by `call`
11+
* might be improved by knowing the call context.
12+
*/
13+
predicate mayBenefitFromCallContext(Call call, DataFlowCallable f) { none() }
14+
15+
/**
16+
* Gets a viable dispatch target of `call` in the context `ctx`. This is
17+
* restricted to those `call`s for which a context might make a difference.
18+
*/
19+
DataFlowCallable viableImplInCallContext(Call call, Call ctx) { none() }

0 commit comments

Comments
 (0)