-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExercise3.ql
More file actions
26 lines (21 loc) · 778 Bytes
/
Exercise3.ql
File metadata and controls
26 lines (21 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java
// Replace with the solution from exercise 1
class AllocationSite extends Expr {
AllocationSite() { none() }
}
predicate alloc(LocalScopeVariable variable, AllocationSite allocationSite, Callable callable) {
// Replace with the solution from exercise 2.
any()
}
predicate move(LocalScopeVariable dest, Variable src) {
// Exercise 3: Describe how a value in `src` is moved to `dest`
none()
}
predicate varPointsTo(LocalScopeVariable variable, AllocationSite allocationSite) {
alloc(variable, allocationSite, _)
or
exists(LocalScopeVariable src | move(variable, src) and varPointsTo(src, allocationSite))
}
from LocalScopeVariable variable, AllocationSite allocationSite
where varPointsTo(variable, allocationSite)
select variable, allocationSite