Skip to content

Commit 33d38ac

Browse files
committed
CPP: QLDoc Enum.qll.
1 parent 7e90728 commit 33d38ac

File tree

1 file changed

+47
-10
lines changed

1 file changed

+47
-10
lines changed

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

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import semmle.code.cpp.Type
22
private import semmle.code.cpp.internal.ResolveClass
33

44
/**
5-
* A C/C++ enum [N4140 7.2].
5+
* A C/C++ enum [N4140 7.2]. For example, the type `MyEnum` in:
6+
* ```
7+
* enum MyEnum
8+
* {
9+
* MyEnumConstant
10+
* };
11+
* ```
612
*/
713
class Enum extends UserType, IntegralOrEnumType {
814
/** Gets an enumerator of this enumeration. */
@@ -46,7 +52,17 @@ class Enum extends UserType, IntegralOrEnumType {
4652
}
4753

4854
/**
49-
* A C++ enum that is directly enclosed by a function.
55+
* A C++ enum that is directly enclosed by a function. For example, the type
56+
* `MyLocalEnum` in:
57+
* ```
58+
* void myFunction()
59+
* {
60+
* enum MyLocalEnum
61+
* {
62+
* MyLocalEnumConstant
63+
* };
64+
* }
65+
* ```
5066
*/
5167
class LocalEnum extends Enum {
5268
LocalEnum() {
@@ -57,7 +73,18 @@ class LocalEnum extends Enum {
5773
}
5874

5975
/**
60-
* A C++ enum that is declared within a class.
76+
* A C++ enum that is declared within a class. For example, the type
77+
* `MyNestedEnum` in:
78+
* ```
79+
* class MyClass
80+
* {
81+
* public:
82+
* enum MyNestedEnum
83+
* {
84+
* MyNestedEnumConstant
85+
* };
86+
* };
87+
* ```
6188
*/
6289
class NestedEnum extends Enum {
6390

@@ -79,9 +106,14 @@ class NestedEnum extends Enum {
79106
}
80107

81108
/**
82-
* A C++ scoped enum.
83-
*
84-
* For example, `enum class Color { red, blue }`.
109+
* A C++ scoped enum, that is, an enum whose constants must be qualified with
110+
* the name of the enum. For example, the type `Color` in:
111+
* ```
112+
* enum class Color {
113+
* red,
114+
* blue
115+
* }
116+
* ```
85117
*/
86118
class ScopedEnum extends Enum {
87119
ScopedEnum() {
@@ -92,11 +124,16 @@ class ScopedEnum extends Enum {
92124
}
93125

94126
/**
95-
* A C/C++ enumerator [N4140 7.2].
96-
*
97-
* For example: `green` in `enum { red, green, blue }`.
127+
* A C/C++ enumerator [N4140 7.2], also known as an enumeration constant.
98128
*
99-
* Enumerators are also knowns as enumeration constants.
129+
* For example the enumeration constant `green` in:
130+
* ```
131+
* enum {
132+
* red,
133+
* green,
134+
* blue
135+
* }
136+
* ```
100137
*/
101138
class EnumConstant extends Declaration, @enumconstant {
102139
/**

0 commit comments

Comments
 (0)