Skip to content

Commit 3365ff0

Browse files
committed
C++: Ensure that 'PrintIR' for dataflow still compiles.
1 parent 6543da9 commit 3365ff0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRFieldFlowSteps.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FieldFlowPropertyProvider extends IRPropertyProvider {
1313
override string getOperandProperty(Operand operand, string key) {
1414
exists(PostFieldUpdateNode pfun, Content content |
1515
key = "store " + content.toString() and
16-
operand = pfun.getPreUpdateNode().(IndirectOperand).getOperand() and
16+
pfun.getPreUpdateNode().(IndirectOperand).hasOperandAndIndirectionIndex(operand, _) and
1717
result =
1818
strictconcat(string element, Node node |
1919
storeStep(node, content, pfun) and
@@ -25,7 +25,7 @@ class FieldFlowPropertyProvider extends IRPropertyProvider {
2525
or
2626
exists(Node node2, Content content |
2727
key = "read " + content.toString() and
28-
operand = node2.(IndirectOperand).getOperand() and
28+
node2.(IndirectOperand).hasOperandAndIndirectionIndex(operand, _) and
2929
result =
3030
strictconcat(string element, Node node1 |
3131
readStep(node1, content, node2) and

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/PrintIRUtilities.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ private string stars(int k) {
1818
}
1919

2020
string starsForNode(Node node) {
21-
result = stars(node.(IndirectInstruction).getIndirectionIndex())
22-
or
23-
result = stars(node.(IndirectOperand).getIndirectionIndex())
21+
exists(int indirectionIndex |
22+
node.(IndirectInstruction).hasInstructionAndIndirectionIndex(_, indirectionIndex) or
23+
node.(IndirectOperand).hasOperandAndIndirectionIndex(_, indirectionIndex)
24+
|
25+
result = stars(indirectionIndex)
26+
)
2427
or
2528
not node instanceof IndirectInstruction and
2629
not node instanceof IndirectOperand and

0 commit comments

Comments
 (0)