Skip to content

Commit 2e73475

Browse files
authored
Merge pull request github#13215 from MathiasVP/update-qldoc-on-typemention
C++: Update documentation for `TypeMention`
2 parents 34fdeb4 + a475efb commit 2e73475

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

cpp/ql/lib/semmle/code/cpp/Type.qll

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,28 @@ class AutoType extends TemplateParameter {
16991699

17001700
private predicate suppressUnusedThis(Type t) { any() }
17011701

1702-
/** A source code location referring to a type */
1702+
/**
1703+
* A source code location referring to a user-defined type.
1704+
*
1705+
* Note that only _user-defined_ types have `TypeMention`s. In particular,
1706+
* built-in types, and derived types with built-in types as their base don't
1707+
* have any `TypeMention`s. For example, given
1708+
* ```cpp
1709+
* struct S { ... };
1710+
* void f(S s1, int i1) {
1711+
* S s2;
1712+
* S* s3;
1713+
* S& s4 = s2;
1714+
* decltype(s2) s5;
1715+
*
1716+
* int i2;
1717+
* int* i3;
1718+
* int i4[10];
1719+
* }
1720+
* ```
1721+
* there will be a `TypeMention` for the mention of `S` at `S s1`, `S s2`, and `S& s4 = s2`,
1722+
* but not at `decltype(s2) s5`. Additionally, there will be no `TypeMention`s for `int`.
1723+
*/
17031724
class TypeMention extends Locatable, @type_mention {
17041725
override string toString() { result = "type mention" }
17051726

0 commit comments

Comments
 (0)