Skip to content

Commit 18c3bfe

Browse files
authored
Merge pull request #1731 from geoffw0/qldoceg5
CPP: Add syntax examples to QLDoc in Initializer.qll, Parameter.qll
2 parents e27b373 + 2d2890e commit 18c3bfe

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
import semmle.code.cpp.controlflow.ControlFlowGraph
22

33
/**
4-
* A C/C++ declaration initializer.
4+
* A C/C++ declaration initializer. For example the initializers `1`, `2` and
5+
* `3` in the following code:
6+
* ```
7+
* int myVariable = 1;
8+
*
9+
* enum myEnum {
10+
* MYENUMCONST = 2
11+
* };
12+
*
13+
* void myFunction(int param = 3) {
14+
* ...
15+
* }
16+
* ```
517
*/
618
class Initializer extends ControlFlowNode, @initialiser {
719
override Location getLocation() { initialisers(underlyingElement(this),_,_,result) }

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,18 @@ import semmle.code.cpp.Declaration
33
private import semmle.code.cpp.internal.ResolveClass
44

55
/**
6-
* A C/C++ function parameter or catch block parameter.
6+
* A C/C++ function parameter or catch block parameter. For example the
7+
* function parameter `p` and the catch block parameter `e` in the following
8+
* code:
9+
* ```
10+
* void myFunction(int p) {
11+
* try {
12+
* ...
13+
* } catch (const std::exception &e) {
14+
* ...
15+
* }
16+
* }
17+
* ```
718
*
819
* For catch block parameters, there is a one-to-one correspondence between
920
* the `Parameter` and its `ParameterDeclarationEntry`.

0 commit comments

Comments
 (0)