Skip to content

Commit 431a004

Browse files
committed
C++: QLDoc.
1 parent c5ae8d2 commit 431a004

File tree

1 file changed

+15
-4
lines changed
  • cpp/ql/src/semmle/code/cpp/models/implementations

1 file changed

+15
-4
lines changed

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import semmle.code.cpp.models.interfaces.Taint
33
import semmle.code.cpp.models.interfaces.Alias
44
import semmle.code.cpp.models.interfaces.SideEffect
55

6-
/** Pure string functions. */
6+
/**
7+
* A function that operates on strings and is pure. That is, its evaluation is
8+
* guaranteed to be side effect-free.
9+
*/
710
private class PureStrFunction extends AliasFunction, ArrayFunction, TaintFunction,
811
SideEffectFunction {
912
PureStrFunction() {
@@ -89,7 +92,9 @@ private string strcmp() {
8992
]
9093
}
9194

92-
/** String standard `strlen` function, and related functions for computing string lengths. */
95+
/**
96+
* A function such as `strlen` that returns the length of the given string.
97+
*/
9398
private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFunction {
9499
StrLenFunction() {
95100
hasGlobalOrStdOrBslName(["strlen", "strnlen", "wcslen"])
@@ -123,7 +128,10 @@ private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFun
123128
}
124129
}
125130

126-
/** Pure functions. */
131+
/**
132+
* A function that is pure, that is, its evaluation is guaranteed to be side
133+
* effect-free. Excludes functions modeled by `PureStrFunction` and `PureMemFunction`.
134+
*/
127135
private class PureFunction extends TaintFunction, SideEffectFunction {
128136
PureFunction() { hasGlobalOrStdOrBslName(["abs", "labs"]) }
129137

@@ -140,7 +148,10 @@ private class PureFunction extends TaintFunction, SideEffectFunction {
140148
override predicate hasOnlySpecificWriteSideEffects() { any() }
141149
}
142150

143-
/** Pure raw-memory functions. */
151+
/**
152+
* A function that operates on memory buffers and is pure. That is, its
153+
* evaluation is guaranteed to be side effect-free.
154+
*/
144155
private class PureMemFunction extends AliasFunction, ArrayFunction, TaintFunction,
145156
SideEffectFunction {
146157
PureMemFunction() {

0 commit comments

Comments
 (0)