Skip to content

Commit 0cc4b23

Browse files
committed
CPP: QLDoc some predicates.
1 parent ab0505e commit 0cc4b23

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

cpp/ql/src/Architecture/Refactoring Opportunities/ClassesWithManyFields.ql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
*/
1212
import cpp
1313

14+
/**
15+
* Gets a string describing the kind of a `Class`.
16+
*/
1417
string kindstr(Class c)
1518
{
1619
exists(int kind | usertypes(unresolveElement(c), _, kind) |
@@ -20,13 +23,20 @@ string kindstr(Class c)
2023
)
2124
}
2225

26+
/**
27+
* Holds if the arguments correspond to information about a `VariableDeclarationEntry`.
28+
*/
2329
predicate vdeInfo(VariableDeclarationEntry vde, Class c, File f, int line)
2430
{
2531
c = vde.getVariable().getDeclaringType() and
2632
f = vde.getLocation().getFile() and
2733
line = vde.getLocation().getStartLine()
2834
}
2935

36+
/**
37+
* Holds if `previous` describes a `VariableDeclarationEntry` occurring soon before
38+
* `vde` (this may have many results).
39+
*/
3040
predicate previousVde(VariableDeclarationEntry previous, VariableDeclarationEntry vde)
3141
{
3242
exists(Class c, File f, int line | vdeInfo(vde, c, f, line) |
@@ -40,12 +50,19 @@ predicate previousVde(VariableDeclarationEntry previous, VariableDeclarationEntr
4050
)
4151
}
4252

53+
/**
54+
* The first `VariableDeclarationEntry` in a group.
55+
*/
4356
predicate masterVde(VariableDeclarationEntry master, VariableDeclarationEntry vde)
4457
{
4558
(not previousVde(_, vde) and master = vde) or
4659
exists(VariableDeclarationEntry previous | previousVde(previous, vde) and masterVde(master, previous))
4760
}
4861

62+
/**
63+
* A group of `VariableDeclaratinEntry`'s in the same class and in close proximity
64+
* to each other.
65+
*/
4966
class VariableDeclarationGroup extends ElementBase {
5067
VariableDeclarationGroup() {
5168
this instanceof VariableDeclarationEntry and

0 commit comments

Comments
 (0)