Skip to content

Commit fbe9bc8

Browse files
author
Robert Marsh
committed
C++: add comments in new iterator models
1 parent a1a441d commit fbe9bc8

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ class BeginOrEndFunction extends MemberFunction, TaintFunction, GetIteratorFunct
338338
}
339339
}
340340

341+
/**
342+
* The `std::front_inserter`, `std::inserter`, and `std::back_inserter`
343+
* functions.
344+
*/
341345
class InserterIteratorFunction extends GetIteratorFunction {
342346
InserterIteratorFunction() {
343347
this.hasName(["front_inserter", "inserter", "back_inserter"]) and

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ import semmle.code.cpp.models.Models
1616
*/
1717
abstract class IteratorReferenceFunction extends Function { }
1818

19+
/**
20+
* A function which takes a container and returns an iterator over that container.
21+
*/
1922
abstract class GetIteratorFunction extends Function {
23+
/**
24+
* Holds if the return value or buffer represented by `output` is an iterator over the container
25+
* passd in the argument, qualifier, or buffer represented by `input`.
26+
*/
2027
abstract predicate getsIterator(FunctionInput input, FunctionOutput output);
2128
}

0 commit comments

Comments
 (0)