Skip to content

Commit d804fc5

Browse files
committed
C++: Remove the 'ExprFlowCached' module. Instead we have a single cached module.
1 parent f223c95 commit d804fc5

File tree

1 file changed

+18
-32
lines changed

1 file changed

+18
-32
lines changed

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

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -225,35 +225,7 @@ private module Cached {
225225
)
226226
)
227227
}
228-
}
229-
230-
import Cached
231228

232-
/**
233-
* Holds if data flows from `source` to `sink` in zero or more local
234-
* (intra-procedural) steps.
235-
*/
236-
pragma[inline]
237-
predicate localFlow(Node source, Node sink) { localFlowStep*(source, sink) }
238-
239-
/**
240-
* Holds if data can flow from `i1` to `i2` in zero or more
241-
* local (intra-procedural) steps.
242-
*/
243-
pragma[inline]
244-
predicate localInstructionFlow(Instruction e1, Instruction e2) {
245-
localFlow(instructionNode(e1), instructionNode(e2))
246-
}
247-
248-
/**
249-
* INTERNAL: Do not use.
250-
*
251-
* Ideally this module would be private, but the `asExprInternal` predicate is
252-
* needed in `DefaultTaintTrackingImpl`. Once `DefaultTaintTrackingImpl` is gone
253-
* we can make this module private.
254-
*/
255-
cached
256-
module ExprFlowCached {
257229
/**
258230
* Holds if `n` is an indirect operand of a `PointerArithmeticInstruction`, and
259231
* `e` is the result of loading from the `PointerArithmeticInstruction`.
@@ -303,8 +275,7 @@ module ExprFlowCached {
303275
* `x[i]` steps to the expression `x[i - 1]` without traversing the
304276
* entire chain.
305277
*/
306-
cached
307-
Expr asExprInternal(Node n) {
278+
private Expr asExprInternal(Node n) {
308279
isIndirectBaseOfArrayAccess(n, result)
309280
or
310281
not isIndirectBaseOfArrayAccess(n, _) and
@@ -366,7 +337,23 @@ module ExprFlowCached {
366337
predicate localExprFlowStep(Expr e1, Expr e2) { localExprFlowStepImpl(_, e1, _, e2) }
367338
}
368339

369-
import ExprFlowCached
340+
import Cached
341+
342+
/**
343+
* Holds if data flows from `source` to `sink` in zero or more local
344+
* (intra-procedural) steps.
345+
*/
346+
pragma[inline]
347+
predicate localFlow(Node source, Node sink) { localFlowStep*(source, sink) }
348+
349+
/**
350+
* Holds if data can flow from `i1` to `i2` in zero or more
351+
* local (intra-procedural) steps.
352+
*/
353+
pragma[inline]
354+
predicate localInstructionFlow(Instruction e1, Instruction e2) {
355+
localFlow(instructionNode(e1), instructionNode(e2))
356+
}
370357

371358
/**
372359
* Holds if data can flow from `e1` to `e2` in one or more
@@ -386,7 +373,6 @@ predicate localExprFlow(Expr e1, Expr e2) {
386373
localExprFlowPlus(e1, e2)
387374
}
388375

389-
390376
/**
391377
* A description of the way data may be stored inside an object. Examples
392378
* include instance fields, the contents of a collection object, or the contents

0 commit comments

Comments
 (0)