Merge pull request #14983 from aschackmull/dataflow/deprecate-old-api

Data Flow: Deprecate old data flow api.
This commit is contained in:
Anders Schack-Mulligen
2023-12-08 14:27:25 +01:00
committed by GitHub
79 changed files with 785 additions and 738 deletions

View File

@@ -10,26 +10,18 @@ predicate pointsToOrigin(DataFlow::CfgNode pointer, DataFlow::CfgNode origin) {
origin.getNode() = pointer.getNode().pointsTo().getOrigin()
}
class PointsToConfiguration extends DataFlow::Configuration {
PointsToConfiguration() { this = "PointsToConfiguration" }
module PointsToConfig implements DataFlow::ConfigSig {
predicate isSource(DataFlow::Node node) { pointsToOrigin(_, node) }
override predicate isSource(DataFlow::Node node) { pointsToOrigin(_, node) }
override predicate isSink(DataFlow::Node node) { pointsToOrigin(node, _) }
predicate isSink(DataFlow::Node node) { pointsToOrigin(node, _) }
}
predicate hasFlow(DataFlow::Node origin, DataFlow::Node pointer) {
exists(PointsToConfiguration config, DataFlow::PathNode source, DataFlow::PathNode sink |
source.getNode() = origin and
sink.getNode() = pointer and
config.hasFlowPath(source, sink)
)
}
module PointsToFlow = DataFlow::Global<PointsToConfig>;
from DataFlow::Node pointer, DataFlow::Node origin
where
exists(pointer.getLocation().getFile().getRelativePath()) and
exists(origin.getLocation().getFile().getRelativePath()) and
pointsToOrigin(pointer, origin) and
not hasFlow(origin, pointer)
not PointsToFlow::flow(origin, pointer)
select origin, pointer