mirror of
https://github.com/github/codeql.git
synced 2026-04-22 23:35:14 +02:00
Dataflow: Replace MakeSets with QlBuiltins::InternSets.
This commit is contained in:
@@ -400,21 +400,6 @@ class CastNode extends ExprNode {
|
||||
}
|
||||
}
|
||||
|
||||
private predicate id_member(Member x, Member y) { x = y }
|
||||
|
||||
private predicate idOf_member(Member x, int y) = equivalenceRelation(id_member/2)(x, y)
|
||||
|
||||
private int summarizedCallableId(SummarizedCallable c) {
|
||||
c =
|
||||
rank[result](SummarizedCallable c0, int b, int i, string s |
|
||||
b = 0 and idOf_member(c0.asCallable(), i) and s = ""
|
||||
or
|
||||
b = 1 and i = 0 and s = c0.asSyntheticCallable()
|
||||
|
|
||||
c0 order by b, i, s
|
||||
)
|
||||
}
|
||||
|
||||
private newtype TDataFlowCallable =
|
||||
TSrcCallable(Callable c) or
|
||||
TSummarizedCallable(SummarizedCallable c) or
|
||||
@@ -448,28 +433,10 @@ class DataFlowCallable extends TDataFlowCallable {
|
||||
result = this.asSummarizedCallable().getLocation() or
|
||||
result = this.asFieldScope().getLocation()
|
||||
}
|
||||
|
||||
/** Gets a best-effort total ordering. */
|
||||
int totalorder() {
|
||||
this =
|
||||
rank[result](DataFlowCallable c, int b, int i |
|
||||
b = 0 and idOf_member(c.asCallable(), i)
|
||||
or
|
||||
b = 1 and i = summarizedCallableId(c.asSummarizedCallable())
|
||||
or
|
||||
b = 2 and idOf_member(c.asFieldScope(), i)
|
||||
|
|
||||
c order by b, i
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class DataFlowExpr = Expr;
|
||||
|
||||
private predicate id_call(Call x, Call y) { x = y }
|
||||
|
||||
private predicate idOf_call(Call x, int y) = equivalenceRelation(id_call/2)(x, y)
|
||||
|
||||
private newtype TDataFlowCall =
|
||||
TCall(Call c) or
|
||||
TSummaryCall(SummarizedCallable c, FlowSummaryImpl::Private::SummaryNode receiver) {
|
||||
@@ -502,19 +469,6 @@ class DataFlowCall extends TDataFlowCall {
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/** Gets a best-effort total ordering. */
|
||||
int totalorder() {
|
||||
this =
|
||||
rank[result](DataFlowCall c, int b, int i |
|
||||
b = 0 and idOf_call(c.asCall(), i)
|
||||
or
|
||||
b = 1 and // not guaranteed to be total
|
||||
exists(SummarizedCallable sc | c = TSummaryCall(sc, _) and i = summarizedCallableId(sc))
|
||||
|
|
||||
c order by b, i
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** A source call, that is, a `Call`. */
|
||||
@@ -549,16 +503,10 @@ class SummaryCall extends DataFlowCall, TSummaryCall {
|
||||
override Location getLocation() { result = c.getLocation() }
|
||||
}
|
||||
|
||||
private predicate id(BasicBlock x, BasicBlock y) { x = y }
|
||||
|
||||
private predicate idOf(BasicBlock x, int y) = equivalenceRelation(id/2)(x, y)
|
||||
|
||||
class NodeRegion instanceof BasicBlock {
|
||||
string toString() { result = "NodeRegion" }
|
||||
|
||||
predicate contains(Node n) { n.asExpr().getBasicBlock() = this }
|
||||
|
||||
int totalOrder() { idOf(this, result) }
|
||||
}
|
||||
|
||||
/** Holds if `e` is an expression that always has the same Boolean value `val`. */
|
||||
|
||||
Reference in New Issue
Block a user