Skip to content

Commit 6897b20

Browse files
authored
Merge pull request github#11601 from MathiasVP/keep-std-string-iterator
2 parents 670ae6c + 54c12cd commit 6897b20

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,24 @@ private class StdBasicString extends ClassTemplateInstantiation {
1515
StdBasicString() { this.hasQualifiedName(["std", "bsl"], "basic_string") }
1616
}
1717

18+
/**
19+
* The `std::basic_string::iterator` declaration.
20+
*
21+
* Intuitively, this class shouldn't be necessary as it's already captured
22+
* by the `StdIterator` class. However, this class ensures that the typedef inside the
23+
* body of the `std::string` class is also seen as an iterator.
24+
*
25+
* Eventually, we should be consistent about which of the following should be recognized as iterators:
26+
* 1. The typedef type.
27+
* 2. The template class of the resolved type.
28+
* 3. Any instantiation of the resolved type.
29+
*/
30+
private class StdBasicStringIterator extends Iterator, Type {
31+
StdBasicStringIterator() {
32+
this.getEnclosingElement() instanceof StdBasicString and this.hasName("iterator")
33+
}
34+
}
35+
1836
/**
1937
* A `std::string` function for which taint should be propagated.
2038
*/

0 commit comments

Comments
 (0)