Skip to content

Commit 64eb4ff

Browse files
authored
Merge pull request #14983 from aschackmull/dataflow/deprecate-old-api
Data Flow: Deprecate old data flow api.
2 parents 30c67ba + 9fafa97 commit 64eb4ff

File tree

79 files changed

+785
-738
lines changed

Some content is hidden

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

79 files changed

+785
-738
lines changed

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import FlowStateString
1414
private import codeql.util.Unit
1515

1616
/**
17+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
18+
*
1719
* A configuration of interprocedural data flow analysis. This defines
1820
* sources, sinks, and any other configurable aspect of the analysis. Each
1921
* use of the global data flow library must define its own unique extension
@@ -48,7 +50,7 @@ private import codeql.util.Unit
4850
* should instead depend on a `DataFlow2::Configuration`, a
4951
* `DataFlow3::Configuration`, or a `DataFlow4::Configuration`.
5052
*/
51-
abstract class Configuration extends string {
53+
abstract deprecated class Configuration extends string {
5254
bindingset[this]
5355
Configuration() { any() }
5456

@@ -189,7 +191,7 @@ abstract class Configuration extends string {
189191
* Good performance cannot be guaranteed in the presence of such recursion, so
190192
* it should be replaced by using more than one copy of the data flow library.
191193
*/
192-
abstract private class ConfigurationRecursionPrevention extends Configuration {
194+
abstract deprecated private class ConfigurationRecursionPrevention extends Configuration {
193195
bindingset[this]
194196
ConfigurationRecursionPrevention() { any() }
195197

@@ -210,7 +212,7 @@ abstract private class ConfigurationRecursionPrevention extends Configuration {
210212
}
211213
}
212214

213-
private FlowState relevantState(Configuration config) {
215+
deprecated private FlowState relevantState(Configuration config) {
214216
config.isSource(_, result) or
215217
config.isSink(_, result) or
216218
config.isBarrier(_, result) or
@@ -219,17 +221,17 @@ private FlowState relevantState(Configuration config) {
219221
}
220222

221223
private newtype TConfigState =
222-
TMkConfigState(Configuration config, FlowState state) {
224+
deprecated TMkConfigState(Configuration config, FlowState state) {
223225
state = relevantState(config) or state instanceof FlowStateEmpty
224226
}
225227

226-
private Configuration getConfig(TConfigState state) { state = TMkConfigState(result, _) }
228+
deprecated private Configuration getConfig(TConfigState state) { state = TMkConfigState(result, _) }
227229

228-
private FlowState getState(TConfigState state) { state = TMkConfigState(_, result) }
230+
deprecated private FlowState getState(TConfigState state) { state = TMkConfigState(_, result) }
229231

230-
private predicate singleConfiguration() { 1 = strictcount(Configuration c) }
232+
deprecated private predicate singleConfiguration() { 1 = strictcount(Configuration c) }
231233

232-
private module Config implements FullStateConfigSig {
234+
deprecated private module Config implements FullStateConfigSig {
233235
class FlowState = TConfigState;
234236

235237
predicate isSource(Node source, FlowState state) {
@@ -296,13 +298,13 @@ private module Config implements FullStateConfigSig {
296298
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
297299
}
298300

299-
private import Impl<Config> as I
301+
deprecated private import Impl<Config> as I
300302

301303
/**
302304
* A `Node` augmented with a call context (except for sinks), an access path, and a configuration.
303305
* Only those `PathNode`s that are reachable from a source, and which can reach a sink, are generated.
304306
*/
305-
class PathNode instanceof I::PathNode {
307+
deprecated class PathNode instanceof I::PathNode {
306308
/** Gets a textual representation of this element. */
307309
final string toString() { result = super.toString() }
308310

@@ -329,10 +331,10 @@ class PathNode instanceof I::PathNode {
329331
final Node getNode() { result = super.getNode() }
330332

331333
/** Gets the `FlowState` of this node. */
332-
final FlowState getState() { result = getState(super.getState()) }
334+
deprecated final FlowState getState() { result = getState(super.getState()) }
333335

334336
/** Gets the associated configuration. */
335-
final Configuration getConfiguration() { result = getConfig(super.getState()) }
337+
deprecated final Configuration getConfiguration() { result = getConfig(super.getState()) }
336338

337339
/** Gets a successor of this node, if any. */
338340
final PathNode getASuccessor() { result = super.getASuccessor() }
@@ -347,20 +349,20 @@ class PathNode instanceof I::PathNode {
347349
final predicate isSinkGroup(string group) { super.isSinkGroup(group) }
348350
}
349351

350-
module PathGraph = I::PathGraph;
352+
deprecated module PathGraph = I::PathGraph;
351353

352-
private predicate hasFlow(Node source, Node sink, Configuration config) {
354+
deprecated private predicate hasFlow(Node source, Node sink, Configuration config) {
353355
exists(PathNode source0, PathNode sink0 |
354356
hasFlowPath(source0, sink0, config) and
355357
source0.getNode() = source and
356358
sink0.getNode() = sink
357359
)
358360
}
359361

360-
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
362+
deprecated private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
361363
I::flowPath(source, sink) and source.getConfiguration() = config
362364
}
363365

364-
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }
366+
deprecated private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }
365367

366-
predicate flowsTo = hasFlow/3;
368+
deprecated predicate flowsTo = hasFlow/3;

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import FlowStateString
1414
private import codeql.util.Unit
1515

1616
/**
17+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
18+
*
1719
* A configuration of interprocedural data flow analysis. This defines
1820
* sources, sinks, and any other configurable aspect of the analysis. Each
1921
* use of the global data flow library must define its own unique extension
@@ -48,7 +50,7 @@ private import codeql.util.Unit
4850
* should instead depend on a `DataFlow2::Configuration`, a
4951
* `DataFlow3::Configuration`, or a `DataFlow4::Configuration`.
5052
*/
51-
abstract class Configuration extends string {
53+
abstract deprecated class Configuration extends string {
5254
bindingset[this]
5355
Configuration() { any() }
5456

@@ -189,7 +191,7 @@ abstract class Configuration extends string {
189191
* Good performance cannot be guaranteed in the presence of such recursion, so
190192
* it should be replaced by using more than one copy of the data flow library.
191193
*/
192-
abstract private class ConfigurationRecursionPrevention extends Configuration {
194+
abstract deprecated private class ConfigurationRecursionPrevention extends Configuration {
193195
bindingset[this]
194196
ConfigurationRecursionPrevention() { any() }
195197

@@ -210,7 +212,7 @@ abstract private class ConfigurationRecursionPrevention extends Configuration {
210212
}
211213
}
212214

213-
private FlowState relevantState(Configuration config) {
215+
deprecated private FlowState relevantState(Configuration config) {
214216
config.isSource(_, result) or
215217
config.isSink(_, result) or
216218
config.isBarrier(_, result) or
@@ -219,17 +221,17 @@ private FlowState relevantState(Configuration config) {
219221
}
220222

221223
private newtype TConfigState =
222-
TMkConfigState(Configuration config, FlowState state) {
224+
deprecated TMkConfigState(Configuration config, FlowState state) {
223225
state = relevantState(config) or state instanceof FlowStateEmpty
224226
}
225227

226-
private Configuration getConfig(TConfigState state) { state = TMkConfigState(result, _) }
228+
deprecated private Configuration getConfig(TConfigState state) { state = TMkConfigState(result, _) }
227229

228-
private FlowState getState(TConfigState state) { state = TMkConfigState(_, result) }
230+
deprecated private FlowState getState(TConfigState state) { state = TMkConfigState(_, result) }
229231

230-
private predicate singleConfiguration() { 1 = strictcount(Configuration c) }
232+
deprecated private predicate singleConfiguration() { 1 = strictcount(Configuration c) }
231233

232-
private module Config implements FullStateConfigSig {
234+
deprecated private module Config implements FullStateConfigSig {
233235
class FlowState = TConfigState;
234236

235237
predicate isSource(Node source, FlowState state) {
@@ -296,13 +298,13 @@ private module Config implements FullStateConfigSig {
296298
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
297299
}
298300

299-
private import Impl<Config> as I
301+
deprecated private import Impl<Config> as I
300302

301303
/**
302304
* A `Node` augmented with a call context (except for sinks), an access path, and a configuration.
303305
* Only those `PathNode`s that are reachable from a source, and which can reach a sink, are generated.
304306
*/
305-
class PathNode instanceof I::PathNode {
307+
deprecated class PathNode instanceof I::PathNode {
306308
/** Gets a textual representation of this element. */
307309
final string toString() { result = super.toString() }
308310

@@ -329,10 +331,10 @@ class PathNode instanceof I::PathNode {
329331
final Node getNode() { result = super.getNode() }
330332

331333
/** Gets the `FlowState` of this node. */
332-
final FlowState getState() { result = getState(super.getState()) }
334+
deprecated final FlowState getState() { result = getState(super.getState()) }
333335

334336
/** Gets the associated configuration. */
335-
final Configuration getConfiguration() { result = getConfig(super.getState()) }
337+
deprecated final Configuration getConfiguration() { result = getConfig(super.getState()) }
336338

337339
/** Gets a successor of this node, if any. */
338340
final PathNode getASuccessor() { result = super.getASuccessor() }
@@ -347,20 +349,20 @@ class PathNode instanceof I::PathNode {
347349
final predicate isSinkGroup(string group) { super.isSinkGroup(group) }
348350
}
349351

350-
module PathGraph = I::PathGraph;
352+
deprecated module PathGraph = I::PathGraph;
351353

352-
private predicate hasFlow(Node source, Node sink, Configuration config) {
354+
deprecated private predicate hasFlow(Node source, Node sink, Configuration config) {
353355
exists(PathNode source0, PathNode sink0 |
354356
hasFlowPath(source0, sink0, config) and
355357
source0.getNode() = source and
356358
sink0.getNode() = sink
357359
)
358360
}
359361

360-
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
362+
deprecated private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
361363
I::flowPath(source, sink) and source.getConfiguration() = config
362364
}
363365

364-
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }
366+
deprecated private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }
365367

366-
predicate flowsTo = hasFlow/3;
368+
deprecated predicate flowsTo = hasFlow/3;

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import FlowStateString
1414
private import codeql.util.Unit
1515

1616
/**
17+
* DEPRECATED: Use `Global` and `GlobalWithState` instead.
18+
*
1719
* A configuration of interprocedural data flow analysis. This defines
1820
* sources, sinks, and any other configurable aspect of the analysis. Each
1921
* use of the global data flow library must define its own unique extension
@@ -48,7 +50,7 @@ private import codeql.util.Unit
4850
* should instead depend on a `DataFlow2::Configuration`, a
4951
* `DataFlow3::Configuration`, or a `DataFlow4::Configuration`.
5052
*/
51-
abstract class Configuration extends string {
53+
abstract deprecated class Configuration extends string {
5254
bindingset[this]
5355
Configuration() { any() }
5456

@@ -189,7 +191,7 @@ abstract class Configuration extends string {
189191
* Good performance cannot be guaranteed in the presence of such recursion, so
190192
* it should be replaced by using more than one copy of the data flow library.
191193
*/
192-
abstract private class ConfigurationRecursionPrevention extends Configuration {
194+
abstract deprecated private class ConfigurationRecursionPrevention extends Configuration {
193195
bindingset[this]
194196
ConfigurationRecursionPrevention() { any() }
195197

@@ -210,7 +212,7 @@ abstract private class ConfigurationRecursionPrevention extends Configuration {
210212
}
211213
}
212214

213-
private FlowState relevantState(Configuration config) {
215+
deprecated private FlowState relevantState(Configuration config) {
214216
config.isSource(_, result) or
215217
config.isSink(_, result) or
216218
config.isBarrier(_, result) or
@@ -219,17 +221,17 @@ private FlowState relevantState(Configuration config) {
219221
}
220222

221223
private newtype TConfigState =
222-
TMkConfigState(Configuration config, FlowState state) {
224+
deprecated TMkConfigState(Configuration config, FlowState state) {
223225
state = relevantState(config) or state instanceof FlowStateEmpty
224226
}
225227

226-
private Configuration getConfig(TConfigState state) { state = TMkConfigState(result, _) }
228+
deprecated private Configuration getConfig(TConfigState state) { state = TMkConfigState(result, _) }
227229

228-
private FlowState getState(TConfigState state) { state = TMkConfigState(_, result) }
230+
deprecated private FlowState getState(TConfigState state) { state = TMkConfigState(_, result) }
229231

230-
private predicate singleConfiguration() { 1 = strictcount(Configuration c) }
232+
deprecated private predicate singleConfiguration() { 1 = strictcount(Configuration c) }
231233

232-
private module Config implements FullStateConfigSig {
234+
deprecated private module Config implements FullStateConfigSig {
233235
class FlowState = TConfigState;
234236

235237
predicate isSource(Node source, FlowState state) {
@@ -296,13 +298,13 @@ private module Config implements FullStateConfigSig {
296298
predicate includeHiddenNodes() { any(Configuration config).includeHiddenNodes() }
297299
}
298300

299-
private import Impl<Config> as I
301+
deprecated private import Impl<Config> as I
300302

301303
/**
302304
* A `Node` augmented with a call context (except for sinks), an access path, and a configuration.
303305
* Only those `PathNode`s that are reachable from a source, and which can reach a sink, are generated.
304306
*/
305-
class PathNode instanceof I::PathNode {
307+
deprecated class PathNode instanceof I::PathNode {
306308
/** Gets a textual representation of this element. */
307309
final string toString() { result = super.toString() }
308310

@@ -329,10 +331,10 @@ class PathNode instanceof I::PathNode {
329331
final Node getNode() { result = super.getNode() }
330332

331333
/** Gets the `FlowState` of this node. */
332-
final FlowState getState() { result = getState(super.getState()) }
334+
deprecated final FlowState getState() { result = getState(super.getState()) }
333335

334336
/** Gets the associated configuration. */
335-
final Configuration getConfiguration() { result = getConfig(super.getState()) }
337+
deprecated final Configuration getConfiguration() { result = getConfig(super.getState()) }
336338

337339
/** Gets a successor of this node, if any. */
338340
final PathNode getASuccessor() { result = super.getASuccessor() }
@@ -347,20 +349,20 @@ class PathNode instanceof I::PathNode {
347349
final predicate isSinkGroup(string group) { super.isSinkGroup(group) }
348350
}
349351

350-
module PathGraph = I::PathGraph;
352+
deprecated module PathGraph = I::PathGraph;
351353

352-
private predicate hasFlow(Node source, Node sink, Configuration config) {
354+
deprecated private predicate hasFlow(Node source, Node sink, Configuration config) {
353355
exists(PathNode source0, PathNode sink0 |
354356
hasFlowPath(source0, sink0, config) and
355357
source0.getNode() = source and
356358
sink0.getNode() = sink
357359
)
358360
}
359361

360-
private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
362+
deprecated private predicate hasFlowPath(PathNode source, PathNode sink, Configuration config) {
361363
I::flowPath(source, sink) and source.getConfiguration() = config
362364
}
363365

364-
private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }
366+
deprecated private predicate hasFlowTo(Node sink, Configuration config) { hasFlow(_, sink, config) }
365367

366-
predicate flowsTo = hasFlow/3;
368+
deprecated predicate flowsTo = hasFlow/3;

0 commit comments

Comments
 (0)