Skip to content

Commit 73194a5

Browse files
committed
C++: Fix QL-for-QL warnings and missing QLDoc
1 parent 26a1f48 commit 73194a5

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/MustFlow.qll

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
private import cpp
88
private import semmle.code.cpp.ir.IR
99

10+
/**
11+
* Provides an inter-procedural must-flow data flow analysis.
12+
*/
1013
module MustFlow {
1114
/**
1215
* An input configuration of a data flow analysis that performs must-flow analysis. This is different
@@ -39,6 +42,9 @@ module MustFlow {
3942
default predicate allowInterproceduralFlow() { any() }
4043
}
4144

45+
/**
46+
* Constructs a global must-flow computation.
47+
*/
4248
module Global<ConfigSig Config> {
4349
import Config
4450

@@ -170,7 +176,7 @@ module MustFlow {
170176
not f.isVirtual() and
171177
call.getPositionalArgument(n) = instr and
172178
f = call.getStaticCallTarget() and
173-
getEnclosingNonVirtualFunctionInitializeParameter(init, f) and
179+
isEnclosingNonVirtualFunctionInitializeParameter(init, f) and
174180
init.getParameter().getIndex() = pragma[only_bind_into](pragma[only_bind_out](n))
175181
}
176182

@@ -179,7 +185,7 @@ module MustFlow {
179185
* corresponding initialization instruction that receives the value of `instr` in `f`.
180186
*/
181187
pragma[noinline]
182-
private predicate getPositionalArgumentInitParam(
188+
private predicate isPositionalArgumentInitParam(
183189
CallInstruction call, Instruction instr, InitializeParameterInstruction init, Function f
184190
) {
185191
exists(int n |
@@ -194,42 +200,42 @@ module MustFlow {
194200
* `instr` in `f`.
195201
*/
196202
pragma[noinline]
197-
private predicate getThisArgumentInitParam(
203+
private predicate isThisArgumentInitParam(
198204
CallInstruction call, Instruction instr, InitializeParameterInstruction init, Function f
199205
) {
200206
not f.isVirtual() and
201207
call.getStaticCallTarget() = f and
202-
getEnclosingNonVirtualFunctionInitializeParameter(init, f) and
208+
isEnclosingNonVirtualFunctionInitializeParameter(init, f) and
203209
call.getThisArgument() = instr and
204210
init.getIRVariable() instanceof IRThisVariable
205211
}
206212

207213
/** Holds if `f` is the enclosing non-virtual function of `init`. */
208-
private predicate getEnclosingNonVirtualFunctionInitializeParameter(
214+
private predicate isEnclosingNonVirtualFunctionInitializeParameter(
209215
InitializeParameterInstruction init, Function f
210216
) {
211217
not f.isVirtual() and
212218
init.getEnclosingFunction() = f
213219
}
214220

215221
/** Holds if `f` is the enclosing non-virtual function of `init`. */
216-
private predicate getEnclosingNonVirtualFunctionInitializeIndirection(
222+
private predicate isEnclosingNonVirtualFunctionInitializeIndirection(
217223
InitializeIndirectionInstruction init, Function f
218224
) {
219225
not f.isVirtual() and
220226
init.getEnclosingFunction() = f
221227
}
222228

223229
/**
224-
* Holds if `instr` is an argument (or argument indirection) to a call, and
225-
* `succ` is the corresponding initialization instruction in the call target.
230+
* Holds if `argument` is an argument (or argument indirection) to a call, and
231+
* `parameter` is the corresponding initialization instruction in the call target.
226232
*/
227233
private predicate flowThroughCallable(Instruction argument, Instruction parameter) {
228234
// Flow from an argument to a parameter
229235
exists(CallInstruction call, InitializeParameterInstruction init | init = parameter |
230-
getPositionalArgumentInitParam(call, argument, init, call.getStaticCallTarget())
236+
isPositionalArgumentInitParam(call, argument, init, call.getStaticCallTarget())
231237
or
232-
getThisArgumentInitParam(call, argument, init, call.getStaticCallTarget())
238+
isThisArgumentInitParam(call, argument, init, call.getStaticCallTarget())
233239
)
234240
or
235241
// Flow from argument indirection to parameter indirection
@@ -238,7 +244,7 @@ module MustFlow {
238244
|
239245
init = parameter and
240246
read.getPrimaryInstruction() = call and
241-
getEnclosingNonVirtualFunctionInitializeIndirection(init, call.getStaticCallTarget())
247+
isEnclosingNonVirtualFunctionInitializeIndirection(init, call.getStaticCallTarget())
242248
|
243249
exists(int n |
244250
read.getSideEffectOperand().getAnyDef() = argument and

0 commit comments

Comments
 (0)