Merge pull request #1731 from geoffw0/qldoceg5

CPP: Add syntax examples to QLDoc in Initializer.qll, Parameter.qll
This commit is contained in:
Jonas Jensen
2019-08-13 08:52:05 +02:00
committed by GitHub
2 changed files with 25 additions and 2 deletions

View File

@@ -1,7 +1,19 @@
import semmle.code.cpp.controlflow.ControlFlowGraph
/**
* A C/C++ declaration initializer.
* A C/C++ declaration initializer. For example the initializers `1`, `2` and
* `3` in the following code:
* ```
* int myVariable = 1;
*
* enum myEnum {
* MYENUMCONST = 2
* };
*
* void myFunction(int param = 3) {
* ...
* }
* ```
*/
class Initializer extends ControlFlowNode, @initialiser {
override Location getLocation() { initialisers(underlyingElement(this),_,_,result) }

View File

@@ -3,7 +3,18 @@ import semmle.code.cpp.Declaration
private import semmle.code.cpp.internal.ResolveClass
/**
* A C/C++ function parameter or catch block parameter.
* A C/C++ function parameter or catch block parameter. For example the
* function parameter `p` and the catch block parameter `e` in the following
* code:
* ```
* void myFunction(int p) {
* try {
* ...
* } catch (const std::exception &e) {
* ...
* }
* }
* ```
*
* For catch block parameters, there is a one-to-one correspondence between
* the `Parameter` and its `ParameterDeclarationEntry`.