File tree Expand file tree Collapse file tree
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal
rust/ql/test/query-tests/diagnostics
unified/ql/lib/codeql/unified/internal/dataflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,6 +217,16 @@ private module IteratorIndirections {
217217 )
218218 }
219219
220+ // A by-value crement result loads the iterator, rather than aliasing its address.
221+ override predicate isAdditionalDereference ( Instruction deref , Operand address ) {
222+ exists ( CallInstruction call |
223+ deref = call and
224+ call .getStaticCallTarget ( ) instanceof Iterator:: IteratorCrementMemberOperator and
225+ not call .getResultType ( ) instanceof Cpp:: ReferenceType and
226+ address = call .getThisArgumentOperand ( )
227+ )
228+ }
229+
220230 override predicate isAdditionalConversionFlow ( Operand opFrom , Instruction instrTo ) {
221231 // This is a bit annoying: Consider the following snippet:
222232 // ```
@@ -255,11 +265,11 @@ private module IteratorIndirections {
255265 store .getDestinationAddress ( ) = var
256266 )
257267 or
258- // A call to `operator++` or `operator--` is the iterator equivalent version of a
259- // pointer arithmetic instruction.
268+ // A reference-returning `operator++` or `operator--` preserves the iterator's address.
260269 exists ( CallInstruction call |
261270 instrTo = call and
262271 call .getStaticCallTarget ( ) instanceof Iterator:: IteratorCrementMemberOperator and
272+ call .getResultType ( ) instanceof Cpp:: ReferenceType and
263273 opFrom = call .getThisArgumentOperand ( )
264274 )
265275 }
Original file line number Diff line number Diff line change 1- | Definition cannot reach a read | 0 |
2- | End of a basic block can be reached by multiple definitions | 0 |
3- | Phi has less than 2 immediately prior references | 0 |
4- | Phi node has less than two inputs | 0 |
5- | Phi read has less than 2 immediately prior references | 0 |
6- | Read can be reached from multiple definitions | 0 |
7- | Read cannot be reached from a definition | 0 |
8- | Read does not have a prior reference | 0 |
9- | Read has multiple prior references | 0 |
10- | Read is not dominated by a definition | 0 |
You can’t perform that action at this time.
0 commit comments