Skip to content

Commit 70d3e69

Browse files
committed
C++: Rename 'lambda' to 'virtual'.
1 parent 02bf923 commit 70d3e69

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private predicate ignoreConstructor(Expr e) {
105105
* constructs an object containing at least one virtual function.
106106
* - a node which represents a derived-to-base instruction that converts from `c`.
107107
*/
108-
private predicate lambdaSourceImpl(RelevantNode n, Class c) {
108+
private predicate qualifierSourceImpl(RelevantNode n, Class c) {
109109
// Object construction
110110
exists(CallInstruction call, ThisArgumentOperand qualifier, Call e |
111111
qualifier = call.getThisArgumentOperand() and
@@ -131,14 +131,14 @@ private predicate lambdaSourceImpl(RelevantNode n, Class c) {
131131
)
132132
}
133133

134-
private module TrackVirtualDispatch<methodDispatchSig/1 lambdaDispatch0> {
134+
private module TrackVirtualDispatch<methodDispatchSig/1 virtualDispatch0> {
135135
/**
136136
* Gets a possible runtime target of `c` using both static call-target
137-
* information, and call-target resolution from `lambdaDispatch0`.
137+
* information, and call-target resolution from `virtualDispatch0`.
138138
*/
139139
private DataFlowPrivate::DataFlowCallable dispatch(DataFlowPrivate::DataFlowCall c) {
140140
result = nonVirtualDispatch(c) or
141-
result = lambdaDispatch0(c)
141+
result = virtualDispatch0(c)
142142
}
143143

144144
private module TtInput implements TypeTrackingInput<Location> {
@@ -156,7 +156,7 @@ private module TrackVirtualDispatch<methodDispatchSig/1 lambdaDispatch0> {
156156
or
157157
DataFlowPrivate::jumpStep(_, this)
158158
or
159-
lambdaSourceImpl(this, _)
159+
qualifierSourceImpl(this, _)
160160
}
161161
}
162162

@@ -220,21 +220,23 @@ private module TrackVirtualDispatch<methodDispatchSig/1 lambdaDispatch0> {
220220
predicate hasFeatureBacktrackStoreTarget() { none() }
221221
}
222222

223-
private predicate lambdaSource(RelevantNode n) { lambdaSourceImpl(n, _) }
223+
private predicate qualifierSource(RelevantNode n) { qualifierSourceImpl(n, _) }
224224

225225
/**
226226
* Holds if `n` is the qualifier of `call` which targets the virtual member
227227
* function `mf`.
228228
*/
229-
private predicate lambdaSinkImpl(RelevantNode n, CallInstruction call, MemberFunction mf) {
229+
private predicate qualifierOfVirtualCallImpl(
230+
RelevantNode n, CallInstruction call, MemberFunction mf
231+
) {
230232
n.asOperand() = call.getThisArgumentOperand() and
231233
call.getStaticCallTarget() = mf and
232234
mf.isVirtual()
233235
}
234236

235-
private predicate lambdaSink(RelevantNode n) { lambdaSinkImpl(n, _, _) }
237+
private predicate qualifierOfVirtualCall(RelevantNode n) { qualifierOfVirtualCallImpl(n, _, _) }
236238

237-
private import TypeTracking<Location, TtInput>::TypeTrack<lambdaSource/1>::Graph<lambdaSink/1>
239+
private import TypeTracking<Location, TtInput>::TypeTrack<qualifierSource/1>::Graph<qualifierOfVirtualCall/1>
238240

239241
private predicate edgePlus(PathNode n1, PathNode n2) = fastTC(edges/2)(n1, n2)
240242

@@ -243,7 +245,7 @@ private module TrackVirtualDispatch<methodDispatchSig/1 lambdaDispatch0> {
243245
* qualifier has runtime type `c`.
244246
*/
245247
private MemberFunction mostSpecific(MemberFunction mf, Class c) {
246-
lambdaSinkImpl(_, _, mf) and
248+
qualifierOfVirtualCallImpl(_, _, mf) and
247249
mf.getAnOverridingFunction*() = result and
248250
(
249251
result.getDeclaringType() = c
@@ -267,16 +269,16 @@ private module TrackVirtualDispatch<methodDispatchSig/1 lambdaDispatch0> {
267269
DataFlowPrivate::DataFlowCall call
268270
) {
269271
exists(Class derived, MemberFunction mf |
270-
lambdaSourceImpl(p1.getNode(), derived) and
271-
lambdaSinkImpl(p2.getNode(), call.asCallInstruction(), mf) and
272+
qualifierSourceImpl(p1.getNode(), derived) and
273+
qualifierOfVirtualCallImpl(p2.getNode(), call.asCallInstruction(), mf) and
272274
p1.isSource() and
273275
p2.isSink() and
274276
callable.asSourceCallable() = mostSpecific(mf, derived)
275277
)
276278
}
277279

278280
/** Gets a possible run-time target of `call`. */
279-
DataFlowPrivate::DataFlowCallable lambdaDispatch(DataFlowPrivate::DataFlowCall call) {
281+
DataFlowPrivate::DataFlowCallable virtualDispatch(DataFlowPrivate::DataFlowCall call) {
280282
exists(PathNode p1, PathNode p2 | p1 = p2 or edgePlus(p1, p2) | pairCand(p1, p2, result, call))
281283
}
282284
}
@@ -285,32 +287,32 @@ private DataFlowPrivate::DataFlowCallable noDisp(DataFlowPrivate::DataFlowCall c
285287

286288
pragma[nomagic]
287289
private DataFlowPrivate::DataFlowCallable d1(DataFlowPrivate::DataFlowCall call) {
288-
result = TrackVirtualDispatch<noDisp/1>::lambdaDispatch(call)
290+
result = TrackVirtualDispatch<noDisp/1>::virtualDispatch(call)
289291
}
290292

291293
pragma[nomagic]
292294
private DataFlowPrivate::DataFlowCallable d2(DataFlowPrivate::DataFlowCall call) {
293-
result = TrackVirtualDispatch<d1/1>::lambdaDispatch(call)
295+
result = TrackVirtualDispatch<d1/1>::virtualDispatch(call)
294296
}
295297

296298
pragma[nomagic]
297299
private DataFlowPrivate::DataFlowCallable d3(DataFlowPrivate::DataFlowCall call) {
298-
result = TrackVirtualDispatch<d2/1>::lambdaDispatch(call)
300+
result = TrackVirtualDispatch<d2/1>::virtualDispatch(call)
299301
}
300302

301303
pragma[nomagic]
302304
private DataFlowPrivate::DataFlowCallable d4(DataFlowPrivate::DataFlowCall call) {
303-
result = TrackVirtualDispatch<d3/1>::lambdaDispatch(call)
305+
result = TrackVirtualDispatch<d3/1>::virtualDispatch(call)
304306
}
305307

306308
pragma[nomagic]
307309
private DataFlowPrivate::DataFlowCallable d5(DataFlowPrivate::DataFlowCall call) {
308-
result = TrackVirtualDispatch<d4/1>::lambdaDispatch(call)
310+
result = TrackVirtualDispatch<d4/1>::virtualDispatch(call)
309311
}
310312

311313
pragma[nomagic]
312314
private DataFlowPrivate::DataFlowCallable d6(DataFlowPrivate::DataFlowCall call) {
313-
result = TrackVirtualDispatch<d5/1>::lambdaDispatch(call)
315+
result = TrackVirtualDispatch<d5/1>::virtualDispatch(call)
314316
}
315317

316318
/** Gets a function that might be called by `call`. */

0 commit comments

Comments
 (0)