mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Merge pull request #1731 from geoffw0/qldoceg5
CPP: Add syntax examples to QLDoc in Initializer.qll, Parameter.qll
This commit is contained in:
@@ -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) }
|
||||
|
||||
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user