Python: Prevent joining on scope in PointsToContext::appliesTo

One of those cases where I _wish_ `pragma[inline]` also meant "don't
join on the stuff inside this predicate -- it's inlined for a reason".

Unsurprisingly, joining on the scope first works poorly.
This commit is contained in:
Taus Brock-Nannestad
2021-03-24 23:12:48 +01:00
parent 28d6cad3d0
commit 0ae8b69102

View File

@@ -184,7 +184,11 @@ class PointsToContext extends TPointsToContext {
/** Holds if this context can apply to the CFG node `n`. */
pragma[inline]
predicate appliesTo(ControlFlowNode n) { this.appliesToScope(n.getScope()) }
predicate appliesTo(ControlFlowNode n) {
exists(Scope s |
this.appliesToScope(pragma[only_bind_into](s)) and pragma[only_bind_into](s) = n.getScope()
)
}
/** Holds if this context is a call context. */
predicate isCall() { this = TCallContext(_, _, _) }