Skip to content

Commit 19b14e1

Browse files
committed
C++: Reduce code duplication.
1 parent 959300f commit 19b14e1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -822,19 +822,23 @@ predicate jumpStep(Node n1, Node n2) {
822822
* store step can be used to clear a field (see `clearsContent`).
823823
*/
824824
predicate storeStepImpl(Node node1, Content c, Node node2, boolean certain) {
825-
exists(int indirectionIndex1, int numberOfLoads, StoreInstruction store |
825+
exists(
826+
PostFieldUpdateNode postFieldUpdate, int indirectionIndex1, int numberOfLoads,
827+
StoreInstruction store
828+
|
829+
postFieldUpdate = node2 and
826830
nodeHasInstruction(node1, store, pragma[only_bind_into](indirectionIndex1)) and
827-
node2.(PostFieldUpdateNode).getIndirectionIndex() = 1 and
828-
numberOfLoadsFromOperand(node2.(PostFieldUpdateNode).getFieldAddress(),
831+
postFieldUpdate.getIndirectionIndex() = 1 and
832+
numberOfLoadsFromOperand(postFieldUpdate.getFieldAddress(),
829833
store.getDestinationAddressOperand(), numberOfLoads, certain)
830834
|
831835
exists(FieldContent fc | fc = c |
832-
fc.getField() = node2.(PostFieldUpdateNode).getUpdatedField() and
836+
fc.getField() = postFieldUpdate.getUpdatedField() and
833837
fc.getIndirectionIndex() = 1 + indirectionIndex1 + numberOfLoads
834838
)
835839
or
836840
exists(UnionContent uc | uc = c |
837-
uc.getAField() = node2.(PostFieldUpdateNode).getUpdatedField() and
841+
uc.getAField() = postFieldUpdate.getUpdatedField() and
838842
uc.getIndirectionIndex() = 1 + indirectionIndex1 + numberOfLoads
839843
)
840844
)

0 commit comments

Comments
 (0)