Skip to content

Commit 7942d73

Browse files
authored
Merge pull request #4501 from dbartol/dbartol/PrintPartialFlow
C++: Annotate IR with partial flow info
2 parents 7f2aa81 + 100f13f commit 7942d73

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/PrintIRLocalFlow.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,23 @@ private string getNodeProperty(DataFlow::Node node, string key) {
130130
|
131131
kind, ", "
132132
)
133+
or
134+
// Is there partial flow from a source to this node?
135+
// This property will only be emitted if partial flow is enabled by overriding
136+
// `DataFlow::Configration::explorationLimit()`.
137+
key = "pflow" and
138+
result =
139+
strictconcat(DataFlow::PartialPathNode sourceNode, DataFlow::PartialPathNode destNode, int dist,
140+
int order1, int order2 |
141+
any(DataFlow::Configuration cfg).hasPartialFlow(sourceNode, destNode, dist) and
142+
destNode.getNode() = node and
143+
// Only print flow from a source in the same function.
144+
sourceNode.getNode().getEnclosingCallable() = node.getEnclosingCallable()
145+
|
146+
nodeId(sourceNode.getNode(), order1, order2) + "+" + dist.toString(), ", "
147+
order by
148+
order1, order2, dist desc
149+
)
133150
}
134151

135152
/**

0 commit comments

Comments
 (0)