Skip to content

Commit 88e8969

Browse files
committed
cache the remainder of the pointsto layer
1 parent 79da097 commit 88e8969

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

python/ql/lib/semmle/python/pointsto/PointsTo.qll

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ module PointsToInternal {
274274
}
275275

276276
/** Holds if `var` refers to `(value, origin)` given the context `context`. */
277-
pragma[noinline]
278277
cached
279278
predicate variablePointsTo(
280279
EssaVariable var, PointsToContext context, ObjectInternal value, CfgOrigin origin
@@ -924,6 +923,7 @@ private module InterModulePointsTo {
924923
}
925924
}
926925

926+
cached
927927
module InterProceduralPointsTo {
928928
cached
929929
predicate call(CallNode call, PointsToContext caller, ObjectInternal value) {
@@ -938,7 +938,7 @@ module InterProceduralPointsTo {
938938
PointsToInternal::pointsTo(call.getFunction(), caller, value, _)
939939
}
940940

941-
pragma[noinline]
941+
cached
942942
predicate call_points_to(
943943
CallNode f, PointsToContext context, ObjectInternal value, ControlFlowNode origin
944944
) {
@@ -987,7 +987,7 @@ module InterProceduralPointsTo {
987987
}
988988

989989
/** Points-to for parameter. `def foo(param): ...`. */
990-
pragma[noinline]
990+
cached
991991
predicate parameter_points_to(
992992
ParameterDefinition def, PointsToContext context, ObjectInternal value, ControlFlowNode origin
993993
) {
@@ -1034,6 +1034,7 @@ module InterProceduralPointsTo {
10341034
)
10351035
}
10361036

1037+
cached
10371038
predicate selfMethodCall(
10381039
SelfCallsiteRefinement def, PointsToContext caller, Function func, PointsToContext callee
10391040
) {
@@ -1104,6 +1105,7 @@ module InterProceduralPointsTo {
11041105
* that the number of position arguments (including expansion of `*` argument) exceeds the number of positional arguments by
11051106
* `length` and that the excess arguments start at `start`.
11061107
*/
1108+
cached
11071109
predicate varargs_tuple(
11081110
CallNode call, PointsToContext caller, Function scope, PointsToContext callee, int start,
11091111
int length
@@ -1117,7 +1119,7 @@ module InterProceduralPointsTo {
11171119
}
11181120

11191121
/** Holds if for function scope `func` in context `callee` the `*` parameter will hold the empty tuple. */
1120-
predicate varargs_empty_tuple(Function func, PointsToContext callee) {
1122+
private predicate varargs_empty_tuple(Function func, PointsToContext callee) {
11211123
exists(CallNode call, PointsToContext caller, int parameter_offset |
11221124
callsite_calls_function(call, caller, func, callee, parameter_offset) and
11231125
func.getPositionalParameterCount() - parameter_offset >=
@@ -1136,6 +1138,7 @@ module InterProceduralPointsTo {
11361138
* Holds if the `n`th argument in call `call` with context `caller` points-to `value` from `origin`, including values in tuples
11371139
* expanded by a `*` argument. For example, for the call `f('a', *(`x`,`y`))` the arguments are `('a', 'x', y')`
11381140
*/
1141+
cached
11391142
predicate positional_argument_points_to(
11401143
CallNode call, int n, PointsToContext caller, ObjectInternal value, ControlFlowNode origin
11411144
) {
@@ -1163,7 +1166,7 @@ module InterProceduralPointsTo {
11631166
}
11641167

11651168
/** Holds if the parameter definition `def` points-to `value` from `origin` given the context `context` */
1166-
predicate positional_parameter_points_to(
1169+
private predicate positional_parameter_points_to(
11671170
ParameterDefinition def, PointsToContext context, ObjectInternal value, ControlFlowNode origin
11681171
) {
11691172
exists(CallNode call, int argument, PointsToContext caller, Function func, int offset |
@@ -1312,7 +1315,7 @@ module InterProceduralPointsTo {
13121315
* `var = ...; foo(); use(var)`
13131316
* Where var may be redefined in call to `foo` if `var` escapes (is global or non-local).
13141317
*/
1315-
pragma[inline]
1318+
cached
13161319
predicate callsite_points_to(
13171320
CallsiteRefinement def, PointsToContext context, ObjectInternal value, CfgOrigin origin
13181321
) {

0 commit comments

Comments
 (0)