Skip to content

Commit 1ae22d0

Browse files
committed
C++: Improve comment based on PR feedback.
1 parent a7c98e3 commit 1ae22d0

File tree

1 file changed

+12
-8
lines changed
  • cpp/ql/lib/semmle/code/cpp/models/implementations

1 file changed

+12
-8
lines changed

cpp/ql/lib/semmle/code/cpp/models/implementations/Iterator.qll

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ private class IteratorCrementNonMemberOperatorModel extends IteratorCrementNonMe
141141
}
142142

143143
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
144-
// `buffer` must be `true` or `mustWrite` must be `false` to ensure that
145-
// the IR alias analysis doesn't think that `it++` doesn't completely override
146-
// the value of the iterator. Ideally, the IR alias analysis shouldn't deal with
147-
// iterators, but this is necessary for taintflow to get any results in our iterator tests.
144+
// We have two choices here: either `buffer` must be `true` or `mustWrite`
145+
// must be `false` to ensure that the IR alias analysis doesn't think that
146+
// `it++` completely override the value of the iterator.
147+
// We choose `mustWrite` must be `false`. In that case, the value of
148+
// `buffer` isn't super important (it just decides which kind of read side
149+
// effect will be emitted).
148150
i = 0 and buffer = false and mustWrite = false
149151
}
150152

@@ -193,10 +195,12 @@ private class IteratorCrementMemberOperatorModel extends IteratorCrementMemberOp
193195
}
194196

195197
override predicate hasSpecificWriteSideEffect(ParameterIndex i, boolean buffer, boolean mustWrite) {
196-
// `buffer` must be `true` or `mustWrite` must be `false` to ensure that
197-
// the IR alias analysis doesn't think that `it++` doesn't completely override
198-
// the value of the iterator. Ideally, the IR alias analysis shouldn't deal with
199-
// iterators, but this is necessary for taintflow to get any results in our iterator tests.
198+
// We have two choices here: either `buffer` must be `true` or `mustWrite`
199+
// must be `false` to ensure that the IR alias analysis doesn't think that
200+
// `it++` completely override the value of the iterator.
201+
// We choose `mustWrite` must be `false`. In that case, the value of
202+
// `buffer` isn't super important (it just decides which kind of read side
203+
// effect will be emitted).
200204
i = -1 and buffer = false and mustWrite = false
201205
}
202206

0 commit comments

Comments
 (0)