Skip to content

Commit 100f13f

Browse files
author
Dave Bartolomeo
committed
C++: Annotate IR with partial flow info
I've added one more property to the annotations provided by `PrintIRLocalFlow.qll`: The `pflow` property will now be emitted for any operand or instruction for which `configuration.hasPartialFlow` determines that there is partial flow to that node. This requires that partial flow be enabled via overriding `Configuration::explorationLimit()` in order to display. Otherwise, you'll still just get the local flow info as before.
1 parent 7f2aa81 commit 100f13f

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)