Skip to content

Commit fc142c7

Browse files
committed
CPP: QLDoc cleanup.
1 parent 7c6dfc9 commit fc142c7

File tree

5 files changed

+28
-8
lines changed

5 files changed

+28
-8
lines changed

cpp/ql/src/semmle/code/cpp/Field.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class BitField extends Field {
9696
*/
9797
int getBitOffset() { fieldoffsets(underlyingElement(this),_,result) }
9898

99+
/** Holds if this bitfield is anonymous. */
99100
predicate isAnonymous() {
100101
hasName("(unnamed bitfield)")
101102
}

cpp/ql/src/semmle/code/cpp/Namespace.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Namespace extends NameQualifyingElement, @namespace {
3636
/** Holds if this element is named `name`. */
3737
predicate hasName(string name) { name = this.getName() }
3838

39-
/** Holds if the namespace is anonymous. */
39+
/** Holds if this namespace is anonymous. */
4040
predicate isAnonymous() {
4141
hasName("(unnamed namespace)")
4242
}

cpp/ql/src/semmle/code/cpp/UserType.qll

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@ private import semmle.code.cpp.internal.ResolveClass
99
* `Enum`, and `TypedefType`.
1010
*/
1111
class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @usertype {
12-
/** the name of this type */
12+
/**
13+
* Gets the name of this type.
14+
*/
1315
override string getName() { usertypes(underlyingElement(this),result,_) }
1416

15-
/** the simple name of this type, without any template parameters */
17+
/**
18+
* Gets the simple name of this type, without any template parameters. For example
19+
* if the name of the type is `"myType<int>"`, the simple name is just `"myType"`.
20+
*/
1621
string getSimpleName() {
1722
result = getName().regexpReplaceAll("<.*", "")
1823
}
1924

2025
override predicate hasName(string name) {
2126
usertypes(underlyingElement(this),name,_)
2227
}
28+
29+
/** Holds if this type is anonymous. */
2330
predicate isAnonymous() {
2431
getName().matches("(unnamed%")
2532
}
@@ -54,20 +61,24 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
5461
result.isDefinition()
5562
}
5663

57-
/** the location of the definition */
5864
override Location getDefinitionLocation() {
5965
if exists(getDefinition()) then
6066
result = getDefinition().getLocation()
6167
else
6268
exists(Class t | this.(Class).isConstructedFrom(t) and result = t.getDefinition().getLocation())
6369
}
6470

65-
/** Gets the function that directly encloses this type (if any). */
71+
/**
72+
* Gets the function that directly encloses this type (if any).
73+
*/
6674
Function getEnclosingFunction() {
6775
enclosingfunction(underlyingElement(this),unresolveElement(result))
6876
}
6977

70-
/** Whether this is a local type (i.e. a type that has a directly-enclosing function). */
78+
/**
79+
* Holds if this is a local type (that is, a type that has a directly-enclosing
80+
* function).
81+
*/
7182
predicate isLocal() {
7283
exists(getEnclosingFunction())
7384
}

cpp/ql/src/semmle/code/cpp/Variable.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@ class ParameterDeclarationEntry extends VariableDeclarationEntry {
264264

265265
/**
266266
* A C/C++ variable with block scope [N4140 3.3.3]. In other words, a local
267-
* variable or a function parameter.
267+
* variable or a function parameter. Local variables can be static; use the
268+
* `isStatic` member predicate to detect those.
268269
*/
269270
class LocalScopeVariable extends Variable, @localscopevariable {
270271
/** Gets the function to which this variable belongs. */
@@ -397,6 +398,10 @@ class FunctionPointerMemberVariable extends MemberVariable {
397398
*/
398399
class TemplateVariable extends Variable {
399400
TemplateVariable() { is_variable_template(underlyingElement(this)) }
401+
402+
/**
403+
* Gets an instantiation of this variable template.
404+
*/
400405
Variable getAnInstantiation() { result.isConstructedFrom(this) }
401406
}
402407

cpp/ql/src/semmle/code/cpp/XML.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ class XMLParent extends @xmlparent {
7979
result = this.charsSetUpTo(n-1) + " " + chars))
8080
}
8181

82-
/** Append all the character sequences of this XML parent from left to right, separated by a space. */
82+
/**
83+
* Gets the result of appending all the character sequences of this XML parent from
84+
* left to right, separated by a space.
85+
*/
8386
string allCharactersString() {
8487
result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos)
8588
}

0 commit comments

Comments
 (0)