Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4089788

Browse files
committed
revert caching of some large predicates that caused the DB size to increase too much
1 parent 0da80f9 commit 4089788

4 files changed

Lines changed: 2 additions & 21 deletions

File tree

python/ql/lib/semmle/python/AstExtended.qll

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ abstract class AstNode extends AstNode_ {
1818
* NOTE: For some statements and other purely syntactic elements,
1919
* there may not be a `ControlFlowNode`
2020
*/
21-
cached
22-
ControlFlowNode getAFlowNode() {
23-
Stages::AST::ref() and
24-
py_flow_bb_node(result, this, _, _)
25-
}
21+
ControlFlowNode getAFlowNode() { py_flow_bb_node(result, this, _, _) }
2622

2723
/** Gets the location for this AST node */
2824
cached
@@ -58,11 +54,7 @@ abstract class AstNode extends AstNode_ {
5854
}
5955

6056
/** Whether this contains `inner` syntactically */
61-
cached
62-
predicate contains(AstNode inner) {
63-
Stages::AST::ref() and
64-
this.getAChildNode+() = inner
65-
}
57+
predicate contains(AstNode inner) { this.getAChildNode+() = inner }
6658

6759
pragma[noinline]
6860
private predicate containsInScope(AstNode inner, Scope scope) {

python/ql/lib/semmle/python/Flow.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ class ControlFlowNode extends @py_flow_node {
194194
BasicBlock getBasicBlock() { result.contains(this) }
195195

196196
/** Gets the scope containing this flow node */
197-
cached
198197
Scope getScope() {
199-
Stages::AST::ref() and
200198
if this.getNode() instanceof Scope
201199
then
202200
/* Entry or exit node */

python/ql/lib/semmle/python/internal/CachedStages.qll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ module Stages {
7676
or
7777
exists(any(AstExtended::AstNode n).getParentNode())
7878
or
79-
any(AstExtended::AstNode n).contains(_)
80-
or
81-
exists(any(AstExtended::AstNode n).getAFlowNode())
82-
or
8379
exists(any(PyFlow::BasicBlock b).getImmediateDominator())
8480
or
8581
any(PyFlow::BasicBlock b).strictlyDominates(_)
@@ -170,8 +166,6 @@ module Stages {
170166
exists(any(Flow::ControlFlowNode c).toString())
171167
or
172168
exists(any(ObjectInternal::ObjectInternal o).toString())
173-
or
174-
exists(any(ObjectAPI::Value::named(_)))
175169
}
176170
}
177171

python/ql/lib/semmle/python/objects/ObjectAPI.qll

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ private import semmle.python.pointsto.PointsTo
1010
private import semmle.python.pointsto.PointsToContext
1111
private import semmle.python.pointsto.MRO
1212
private import semmle.python.types.Builtins
13-
private import semmle.python.internal.CachedStages
1413

1514
/*
1615
* Use the term `ObjectSource` to refer to DB entity. Either a CFG node
@@ -264,9 +263,7 @@ module Value {
264263
* object of that name.
265264
* For example `Value::named("len")` is the `Value` representing the `len` built-in function.
266265
*/
267-
cached
268266
Value named(string name) {
269-
Stages::DataFlow::ref() and
270267
exists(string modname, string attrname | name = modname + "." + attrname |
271268
result = Module::named(modname).attr(attrname)
272269
)

0 commit comments

Comments
 (0)