Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b9532c

Browse files
committed
CPP: Examples Namespace.qll.
1 parent 1fd2449 commit 4b9532c

1 file changed

Lines changed: 35 additions & 8 deletions

File tree

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

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@ import semmle.code.cpp.Type
77
import semmle.code.cpp.metrics.MetricNamespace
88

99
/**
10-
* A C++ namespace.
10+
* A C++ namespace. For example the (single) namespace `A` in the following
11+
* code:
12+
* ```
13+
* namespace A
14+
* {
15+
* // ...
16+
* }
1117
*
18+
* // ...
19+
*
20+
* namespace A
21+
* {
22+
* // ...
23+
* }
24+
* ```
1225
* Note that namespaces are somewhat nebulous entities, as they do not in
1326
* general have a single well-defined location in the source code. The
1427
* related notion of a `NamespaceDeclarationEntry` is rather more concrete,
@@ -96,10 +109,22 @@ class Namespace extends NameQualifyingElement, @namespace {
96109
}
97110

98111
/**
99-
* A declaration of (part of) a C++ namespace.
112+
* A declaration of (part of) a C++ namespace. This corresponds to a single
113+
* `namespace N { ... }` occurrence in the source code. For example the two
114+
* mentions of `A` in the following code:
115+
* ```
116+
* namespace A
117+
* {
118+
* // ...
119+
* }
120+
*
121+
* // ...
100122
*
101-
* This corresponds to a single `namespace N { ... }` occurrence in the
102-
* source code.
123+
* namespace A
124+
* {
125+
* // ...
126+
* }
127+
* ```
103128
*/
104129
class NamespaceDeclarationEntry extends Locatable, @namespace_decl {
105130
/**
@@ -143,8 +168,9 @@ class UsingEntry extends Locatable, @using {
143168

144169
/**
145170
* A C++ `using` declaration. For example:
146-
*
147-
* `using std::string;`
171+
* ```
172+
* using std::string;
173+
* ```
148174
*/
149175
class UsingDeclarationEntry extends UsingEntry {
150176
UsingDeclarationEntry() {
@@ -162,8 +188,9 @@ class UsingDeclarationEntry extends UsingEntry {
162188

163189
/**
164190
* A C++ `using` directive. For example:
165-
*
166-
* `using namespace std;`
191+
* ```
192+
* using namespace std;
193+
* ```
167194
*/
168195
class UsingDirectiveEntry extends UsingEntry {
169196
UsingDirectiveEntry() {

0 commit comments

Comments
 (0)