Skip to content

Commit 033eeab

Browse files
committed
cpp: Adds a member predicate to get a FunctionAccess from a Function
- Adds a member predicate to get a FunctionAccess from a Function - Adds QLDoc to getACallToThisFunction.
1 parent 3c8aeb9 commit 033eeab

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
139139
/** Gets a parameter of this function. */
140140
Parameter getAParameter() { params(unresolveElement(result), underlyingElement(this), _, _) }
141141

142+
/**
143+
* Gets an access of this function.
144+
*
145+
* To get calls to this function, use `getACallToThisFunction` instead.
146+
*/
147+
FunctionAccess getAnAccess() { result.getTarget() = this }
148+
142149
/**
143150
* Gets the number of parameters of this function, _not_ including any
144151
* implicit `this` parameter or any `...` varargs pseudo-parameter.
@@ -174,6 +181,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
174181
result = getParameter(index).getTypedName() + ", " + getParameterStringFrom(index + 1)
175182
}
176183

184+
/** Gets a call to this function. */
177185
FunctionCall getACallToThisFunction() { result.getTarget() = this }
178186

179187
/**

0 commit comments

Comments
 (0)