C++: QLDoc.

This commit is contained in:
Geoffrey White
2020-12-03 21:27:58 +00:00
parent c5ae8d2c53
commit 431a004127

View File

@@ -3,7 +3,10 @@ import semmle.code.cpp.models.interfaces.Taint
import semmle.code.cpp.models.interfaces.Alias
import semmle.code.cpp.models.interfaces.SideEffect
/** Pure string functions. */
/**
* A function that operates on strings and is pure. That is, its evaluation is
* guaranteed to be side effect-free.
*/
private class PureStrFunction extends AliasFunction, ArrayFunction, TaintFunction,
SideEffectFunction {
PureStrFunction() {
@@ -89,7 +92,9 @@ private string strcmp() {
]
}
/** String standard `strlen` function, and related functions for computing string lengths. */
/**
* A function such as `strlen` that returns the length of the given string.
*/
private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFunction {
StrLenFunction() {
hasGlobalOrStdOrBslName(["strlen", "strnlen", "wcslen"])
@@ -123,7 +128,10 @@ private class StrLenFunction extends AliasFunction, ArrayFunction, SideEffectFun
}
}
/** Pure functions. */
/**
* A function that is pure, that is, its evaluation is guaranteed to be side
* effect-free. Excludes functions modeled by `PureStrFunction` and `PureMemFunction`.
*/
private class PureFunction extends TaintFunction, SideEffectFunction {
PureFunction() { hasGlobalOrStdOrBslName(["abs", "labs"]) }
@@ -140,7 +148,10 @@ private class PureFunction extends TaintFunction, SideEffectFunction {
override predicate hasOnlySpecificWriteSideEffects() { any() }
}
/** Pure raw-memory functions. */
/**
* A function that operates on memory buffers and is pure. That is, its
* evaluation is guaranteed to be side effect-free.
*/
private class PureMemFunction extends AliasFunction, ArrayFunction, TaintFunction,
SideEffectFunction {
PureMemFunction() {