Skip to content

Commit da06b2a

Browse files
committed
C++: Improve Iterator.qll layout and QLDoc.
1 parent 90dbbbb commit da06b2a

File tree

1 file changed

+10
-6
lines changed
  • cpp/ql/src/semmle/code/cpp/models/implementations

1 file changed

+10
-6
lines changed

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ private class IteratorTraits extends Class {
2626
Type getIteratorType() { result = this.getTemplateArgument(0) }
2727
}
2828

29+
/**
30+
* A type that is deduced to be an iterator because there is a corresponding
31+
* `std::iterator_traits` instantiation for it.
32+
*/
33+
private class IteratorByTraits extends Iterator {
34+
IteratorByTraits() { exists(IteratorTraits it | it.getIteratorType() = this) }
35+
}
36+
2937
/**
3038
* A type which has the typedefs expected for an iterator.
3139
*/
@@ -48,13 +56,9 @@ private class StdIterator extends Iterator, Class {
4856
}
4957

5058
/**
51-
* A type that is deduced to be an iterator because there is a corresponding
52-
* `std::iterator_traits` instantiation for it.
59+
* Gets the `FunctionInput` corresponding to an iterator parameter to
60+
* user-defined operator `op`, at `index`.
5361
*/
54-
private class IteratorByTraits extends Iterator {
55-
IteratorByTraits() { exists(IteratorTraits it | it.getIteratorType() = this) }
56-
}
57-
5862
private FunctionInput getIteratorArgumentInput(Operator op, int index) {
5963
exists(Type t |
6064
t =

0 commit comments

Comments
 (0)