Skip to content

Commit 6545d0b

Browse files
committed
C++: Move conflation check into each disjunct.
1 parent d2d8377 commit 6545d0b

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -744,27 +744,27 @@ private FieldNode getOutermostFieldNode(Instruction address) {
744744

745745
private predicate flowIntoReadNode(Node nodeFrom, FieldNode nodeTo) {
746746
// flow from the memory of a load to the "outermost" field of that load.
747-
not nodeFrom.asInstruction().isResultConflated() and
748-
(
749-
exists(LoadInstruction load |
750-
nodeTo = getOutermostFieldNode(load.getSourceAddress()) and
751-
nodeFrom.asInstruction() = load.getSourceValueOperand().getAnyDef()
752-
)
753-
or
754-
// We need this to make stores look like loads for the dataflow library. So when there's a store
755-
// of the form x->y = z we need to make the field node corresponding to y look like it's reading
756-
// from the memory of x.
757-
exists(StoreInstruction store, ChiInstruction chi |
758-
chi.getPartial() = store and
759-
nodeTo = getOutermostFieldNode(store.getDestinationAddress()) and
760-
nodeFrom.asInstruction() = chi.getTotal()
761-
)
747+
exists(LoadInstruction load |
748+
nodeTo = getOutermostFieldNode(load.getSourceAddress()) and
749+
not nodeFrom.asInstruction().isResultConflated() and
750+
nodeFrom.asInstruction() = load.getSourceValueOperand().getAnyDef()
751+
)
752+
or
753+
// We need this to make stores look like loads for the dataflow library. So when there's a store
754+
// of the form x->y = z we need to make the field node corresponding to y look like it's reading
755+
// from the memory of x.
756+
exists(StoreInstruction store, ChiInstruction chi |
757+
chi.getPartial() = store and
758+
nodeTo = getOutermostFieldNode(store.getDestinationAddress()) and
759+
not nodeFrom.asInstruction().isResultConflated() and
760+
nodeFrom.asInstruction() = chi.getTotal()
762761
)
763762
or
764-
exists(ReadSideEffectInstruction read |
765-
not read.getSideEffectOperand().getAnyDef().isResultConflated() and
763+
exists(ReadSideEffectInstruction read, SideEffectOperand sideEffect |
764+
sideEffect = read.getSideEffectOperand() and
765+
not sideEffect.getAnyDef().isResultConflated() and
766766
nodeTo = getOutermostFieldNode(read.getArgumentDef()) and
767-
nodeFrom.asOperand() = read.getSideEffectOperand()
767+
nodeFrom.asOperand() = sideEffect
768768
)
769769
}
770770

0 commit comments

Comments
 (0)