-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathExercise3.ql
More file actions
24 lines (19 loc) · 798 Bytes
/
Exercise3.ql
File metadata and controls
24 lines (19 loc) · 798 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
import java
class AllocationSite = ClassInstanceExpr;
predicate alloc(LocalScopeVariable variable, AllocationSite allocationSite, Callable callable) {
variable.getAnAssignedValue() = allocationSite and
allocationSite.getEnclosingCallable() = callable
}
predicate move(LocalScopeVariable dest, Variable src) {
exists(AssignExpr assign |
assign.getSource() = src.getAnAccess() and assign.getDest() = dest.getAnAccess()
)
}
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