Skip to content

Commit 2761aa7

Browse files
committed
Dataflow: Sync.
1 parent cfa5af9 commit 2761aa7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+444
-220
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Provides an implementation of global (interprocedural) data flow. This file
33
* re-exports the local (intraprocedural) data flow analysis from
44
* `DataFlowImplSpecific::Public` and adds a global analysis, mainly exposed
5-
* through the `Make` and `MakeWithState` modules.
5+
* through the `Global` and `GlobalWithState` modules.
66
*/
77

88
private import DataFlowImplCommon
@@ -73,10 +73,10 @@ signature module ConfigSig {
7373
*/
7474
default FlowFeature getAFeature() { none() }
7575

76-
/** Holds if sources should be grouped in the result of `hasFlowPath`. */
76+
/** Holds if sources should be grouped in the result of `flowPath`. */
7777
default predicate sourceGrouping(Node source, string sourceGroup) { none() }
7878

79-
/** Holds if sinks should be grouped in the result of `hasFlowPath`. */
79+
/** Holds if sinks should be grouped in the result of `flowPath`. */
8080
default predicate sinkGrouping(Node sink, string sinkGroup) { none() }
8181

8282
/**
@@ -166,10 +166,10 @@ signature module StateConfigSig {
166166
*/
167167
default FlowFeature getAFeature() { none() }
168168

169-
/** Holds if sources should be grouped in the result of `hasFlowPath`. */
169+
/** Holds if sources should be grouped in the result of `flowPath`. */
170170
default predicate sourceGrouping(Node source, string sourceGroup) { none() }
171171

172-
/** Holds if sinks should be grouped in the result of `hasFlowPath`. */
172+
/** Holds if sinks should be grouped in the result of `flowPath`. */
173173
default predicate sinkGrouping(Node sink, string sinkGroup) { none() }
174174

175175
/**
@@ -182,7 +182,7 @@ signature module StateConfigSig {
182182
}
183183

184184
/**
185-
* Gets the exploration limit for `hasPartialFlow` and `hasPartialFlowRev`
185+
* Gets the exploration limit for `partialFlow` and `partialFlowRev`
186186
* measured in approximate number of interprocedural steps.
187187
*/
188188
signature int explorationLimitSig();
@@ -203,28 +203,28 @@ signature module DataFlowSig {
203203
* The corresponding paths are generated from the end-points and the graph
204204
* included in the module `PathGraph`.
205205
*/
206-
predicate hasFlowPath(PathNode source, PathNode sink);
206+
predicate flowPath(PathNode source, PathNode sink);
207207

208208
/**
209209
* Holds if data can flow from `source` to `sink`.
210210
*/
211-
predicate hasFlow(Node source, Node sink);
211+
predicate flow(Node source, Node sink);
212212

213213
/**
214214
* Holds if data can flow from some source to `sink`.
215215
*/
216-
predicate hasFlowTo(Node sink);
216+
predicate flowTo(Node sink);
217217

218218
/**
219219
* Holds if data can flow from some source to `sink`.
220220
*/
221-
predicate hasFlowToExpr(DataFlowExpr sink);
221+
predicate flowToExpr(DataFlowExpr sink);
222222
}
223223

224224
/**
225225
* Constructs a standard data flow computation.
226226
*/
227-
module Make<ConfigSig Config> implements DataFlowSig {
227+
module Global<ConfigSig Config> implements DataFlowSig {
228228
private module C implements FullStateConfigSig {
229229
import DefaultState<Config>
230230
import Config
@@ -233,17 +233,27 @@ module Make<ConfigSig Config> implements DataFlowSig {
233233
import Impl<C>
234234
}
235235

236+
/** DEPRECATED: Use `Global` instead. */
237+
deprecated module Make<ConfigSig Config> implements DataFlowSig {
238+
import Global<Config>
239+
}
240+
236241
/**
237242
* Constructs a data flow computation using flow state.
238243
*/
239-
module MakeWithState<StateConfigSig Config> implements DataFlowSig {
244+
module GlobalWithState<StateConfigSig Config> implements DataFlowSig {
240245
private module C implements FullStateConfigSig {
241246
import Config
242247
}
243248

244249
import Impl<C>
245250
}
246251

252+
/** DEPRECATED: Use `GlobalWithState` instead. */
253+
deprecated module MakeWithState<StateConfigSig Config> implements DataFlowSig {
254+
import GlobalWithState<Config>
255+
}
256+
247257
signature class PathNodeSig {
248258
/** Gets a textual representation of this element. */
249259
string toString();

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ signature module FullStateConfigSig {
9191
*/
9292
FlowFeature getAFeature();
9393

94-
/** Holds if sources should be grouped in the result of `hasFlowPath`. */
94+
/** Holds if sources should be grouped in the result of `flowPath`. */
9595
predicate sourceGrouping(Node source, string sourceGroup);
9696

97-
/** Holds if sinks should be grouped in the result of `hasFlowPath`. */
97+
/** Holds if sinks should be grouped in the result of `flowPath`. */
9898
predicate sinkGrouping(Node sink, string sinkGroup);
9999

100100
/**
@@ -3633,7 +3633,7 @@ module Impl<FullStateConfigSig Config> {
36333633
* The corresponding paths are generated from the end-points and the graph
36343634
* included in the module `PathGraph`.
36353635
*/
3636-
predicate hasFlowPath(PathNode source, PathNode sink) {
3636+
predicate flowPath(PathNode source, PathNode sink) {
36373637
exists(PathNodeImpl flowsource, PathNodeImpl flowsink |
36383638
source = flowsource and sink = flowsink
36393639
|
@@ -3643,6 +3643,9 @@ module Impl<FullStateConfigSig Config> {
36433643
)
36443644
}
36453645

3646+
/** DEPRECATED: Use `flowPath` instead. */
3647+
deprecated predicate hasFlowPath = flowPath/2;
3648+
36463649
private predicate flowsTo(PathNodeImpl flowsource, PathNodeSink flowsink, Node source, Node sink) {
36473650
flowsource.isSource() and
36483651
flowsource.getNodeEx().asNode() = source and
@@ -3653,17 +3656,26 @@ module Impl<FullStateConfigSig Config> {
36533656
/**
36543657
* Holds if data can flow from `source` to `sink`.
36553658
*/
3656-
predicate hasFlow(Node source, Node sink) { flowsTo(_, _, source, sink) }
3659+
predicate flow(Node source, Node sink) { flowsTo(_, _, source, sink) }
3660+
3661+
/** DEPRECATED: Use `flow` instead. */
3662+
deprecated predicate hasFlow = flow/2;
36573663

36583664
/**
36593665
* Holds if data can flow from some source to `sink`.
36603666
*/
3661-
predicate hasFlowTo(Node sink) { sink = any(PathNodeSink n).getNodeEx().asNode() }
3667+
predicate flowTo(Node sink) { sink = any(PathNodeSink n).getNodeEx().asNode() }
3668+
3669+
/** DEPRECATED: Use `flowTo` instead. */
3670+
deprecated predicate hasFlowTo = flowTo/1;
36623671

36633672
/**
36643673
* Holds if data can flow from some source to `sink`.
36653674
*/
3666-
predicate hasFlowToExpr(DataFlowExpr sink) { hasFlowTo(exprNode(sink)) }
3675+
predicate flowToExpr(DataFlowExpr sink) { flowTo(exprNode(sink)) }
3676+
3677+
/** DEPRECATED: Use `flowToExpr` instead. */
3678+
deprecated predicate hasFlowToExpr = flowToExpr/1;
36673679

36683680
private predicate finalStats(
36693681
boolean fwd, int nodes, int fields, int conscand, int states, int tuples
@@ -4574,7 +4586,7 @@ module Impl<FullStateConfigSig Config> {
45744586
*
45754587
* To use this in a `path-problem` query, import the module `PartialPathGraph`.
45764588
*/
4577-
predicate hasPartialFlow(PartialPathNode source, PartialPathNode node, int dist) {
4589+
predicate partialFlow(PartialPathNode source, PartialPathNode node, int dist) {
45784590
partialFlow(source, node) and
45794591
dist = node.getSourceDistance()
45804592
}
@@ -4594,7 +4606,7 @@ module Impl<FullStateConfigSig Config> {
45944606
* Note that reverse flow has slightly lower precision than the corresponding
45954607
* forward flow, as reverse flow disregards type pruning among other features.
45964608
*/
4597-
predicate hasPartialFlowRev(PartialPathNode node, PartialPathNode sink, int dist) {
4609+
predicate partialFlowRev(PartialPathNode node, PartialPathNode sink, int dist) {
45984610
revPartialFlow(node, sink) and
45994611
dist = node.getSinkDistance()
46004612
}

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl1.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* DEPRECATED: Use `Make` and `MakeWithState` instead.
2+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
33
*
44
* Provides a `Configuration` class backwards-compatible interface to the data
55
* flow library.
@@ -388,7 +388,7 @@ private predicate hasFlow(Node source, Node sink, Configuration config) {
388388
}
389389

390390
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
391-
hasFlowPath(source, sink) and source.getConfiguration() = config
391+
flowPath(source, sink) and source.getConfiguration() = config
392392
}
393393

394394
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }

cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTracking.qll

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private module AddTaintDefaults<DataFlowInternal::FullStateConfigSig Config> imp
3535
/**
3636
* Constructs a standard taint tracking computation.
3737
*/
38-
module Make<DataFlow::ConfigSig Config> implements DataFlow::DataFlowSig {
38+
module Global<DataFlow::ConfigSig Config> implements DataFlow::DataFlowSig {
3939
private module Config0 implements DataFlowInternal::FullStateConfigSig {
4040
import DataFlowInternal::DefaultState<Config>
4141
import Config
@@ -48,10 +48,15 @@ module Make<DataFlow::ConfigSig Config> implements DataFlow::DataFlowSig {
4848
import DataFlowInternal::Impl<C>
4949
}
5050

51+
/** DEPRECATED: Use `Global` instead. */
52+
deprecated module Make<DataFlow::ConfigSig Config> implements DataFlow::DataFlowSig {
53+
import Global<Config>
54+
}
55+
5156
/**
5257
* Constructs a taint tracking computation using flow state.
5358
*/
54-
module MakeWithState<DataFlow::StateConfigSig Config> implements DataFlow::DataFlowSig {
59+
module GlobalWithState<DataFlow::StateConfigSig Config> implements DataFlow::DataFlowSig {
5560
private module Config0 implements DataFlowInternal::FullStateConfigSig {
5661
import Config
5762
}
@@ -62,3 +67,8 @@ module MakeWithState<DataFlow::StateConfigSig Config> implements DataFlow::DataF
6267

6368
import DataFlowInternal::Impl<C>
6469
}
70+
71+
/** DEPRECATED: Use `GlobalWithState` instead. */
72+
deprecated module MakeWithState<DataFlow::StateConfigSig Config> implements DataFlow::DataFlowSig {
73+
import GlobalWithState<Config>
74+
}

0 commit comments

Comments
 (0)