Skip to content

Commit 87569d1

Browse files
committed
CPP: QLDoc comments.
1 parent ba3bc15 commit 87569d1

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

cpp/ql/src/Critical/NotInitialised.ql

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ import cpp
1212

1313
// See also InitialisationNotRun.ql and GlobalUseBeforeInit.ql
1414

15-
// Holds if s defines variable v (conservative)
15+
/**
16+
* Holds if `s` defines variable `v` (conservative).
17+
*/
1618
predicate defines(ControlFlowNode s, Variable lv) {
1719
exists(VariableAccess va | va = s and va.getTarget() = lv and va.isUsedAsLValue())
1820
}
1921

20-
// Holds if s uses variable v (conservative)
22+
/**
23+
* Holds if `s` uses variable `v` (conservative).
24+
*/
2125
predicate uses(ControlFlowNode s, Variable lv) {
2226
exists(VariableAccess va |
2327
va = s and
@@ -27,8 +31,10 @@ predicate uses(ControlFlowNode s, Variable lv) {
2731
)
2832
}
2933

30-
// Holds if there is a path from the declaration of lv to n such that lv is
31-
// definitely not defined before n
34+
/**
35+
* Holds if there is a path from the declaration of `lv` to `n` such that `lv` is
36+
* definitely not defined before `n`.
37+
*/
3238
predicate noDefPath(LocalVariable lv, ControlFlowNode n) {
3339
n.(DeclStmt).getADeclaration() = lv and not exists(lv.getInitializer())
3440
or
@@ -37,8 +43,10 @@ predicate noDefPath(LocalVariable lv, ControlFlowNode n) {
3743

3844
predicate isAggregateType(Type t) { t instanceof Class or t instanceof ArrayType }
3945

40-
// Holds if va is a use of a local variable that has not been previously
41-
// defined
46+
/**
47+
* Holds if `va` is a use of a local variable that has not been previously
48+
* defined.
49+
*/
4250
predicate undefinedLocalUse(VariableAccess va) {
4351
exists(LocalVariable lv |
4452
// it is hard to tell when a struct or array has been initialized, so we
@@ -51,7 +59,9 @@ predicate undefinedLocalUse(VariableAccess va) {
5159
)
5260
}
5361

54-
// Holds if gv is a potentially uninitialized global variable
62+
/**
63+
* Holds if `gv` is a potentially uninitialized global variable.
64+
*/
5565
predicate uninitialisedGlobal(GlobalVariable gv) {
5666
exists(VariableAccess va |
5767
not isAggregateType(gv.getUnderlyingType()) and

0 commit comments

Comments
 (0)