|
| 1 | +/** |
| 2 | + * Print the dataflow local store steps in IR dumps. |
| 3 | + */ |
| 4 | + |
| 5 | +private import cpp |
| 6 | +private import semmle.code.cpp.ir.IR |
| 7 | +private import semmle.code.cpp.ir.dataflow.internal.DataFlowUtil |
| 8 | +private import semmle.code.cpp.ir.dataflow.internal.DataFlowPrivate |
| 9 | +private import PrintIRUtilities |
| 10 | + |
| 11 | +/** |
| 12 | + * Property provider for local IR dataflow store steps. |
| 13 | + */ |
| 14 | +class FieldFlowPropertyProvider extends IRPropertyProvider { |
| 15 | + override string getOperandProperty(Operand operand, string key) { |
| 16 | + exists(PostFieldUpdateNode pfun, Content content | |
| 17 | + key = "store " + content.toString() and |
| 18 | + operand = pfun.getPreUpdateNode().(IndirectOperand).getOperand() and |
| 19 | + result = |
| 20 | + strictconcat(string element, Node node | |
| 21 | + storeStep(node, content, pfun) and |
| 22 | + element = nodeId(node, _, _) |
| 23 | + | |
| 24 | + element, ", " |
| 25 | + ) |
| 26 | + ) |
| 27 | + or |
| 28 | + exists(Node node2, Content content | |
| 29 | + key = "read " + content.toString() and |
| 30 | + operand = node2.(IndirectOperand).getOperand() and |
| 31 | + result = |
| 32 | + strictconcat(string element, Node node1 | |
| 33 | + readStep(node1, content, node2) and |
| 34 | + element = nodeId(node1, _, _) |
| 35 | + | |
| 36 | + element, ", " |
| 37 | + ) |
| 38 | + ) |
| 39 | + } |
| 40 | +} |
0 commit comments