Skip to content

Commit

Permalink
2.18.1 merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Dilan Bhalla committed Jul 31, 2024
1 parent db6fb7b commit 73ee8ef
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ private import Node0ToString
private import ModelUtil
private import semmle.code.cpp.models.interfaces.FunctionInputsAndOutputs as IO
private import semmle.code.cpp.models.interfaces.DataFlow as DF
private import semmle.code.cpp.dataflow.ExternalFlow as External

cached
private module Cached {
Expand Down Expand Up @@ -1060,16 +1061,6 @@ class DataFlowCallable extends TDataFlowCallable {
result = this.asSummarizedCallable() or // SummarizedCallable = Function (in CPP)
result = this.asSourceCallable()
}

/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
|
c order by file, startline, startcolumn
)
}
}

/**
Expand Down Expand Up @@ -1276,15 +1267,6 @@ module IsUnreachableInCall {
string toString() { result = "NodeRegion" }

predicate contains(Node n) { this = n.getBasicBlock() }

int totalOrder() {
this =
rank[result](IRBlock b, int startline, int startcolumn |
b.getLocation().hasLocationInfo(_, startline, startcolumn, _, _)
|
b order by startline, startcolumn
)
}
}

predicate isUnreachableInCall(NodeRegion block, DataFlowCall call) {
Expand Down Expand Up @@ -1369,9 +1351,9 @@ predicate lambdaCall(DataFlowCall call, LambdaCallKind kind, Node receiver) {
/** Extra data-flow steps needed for lambda flow analysis. */
predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preservesValue) { none() }

predicate knownSourceModel(Node source, string model) { none() }
predicate knownSourceModel(Node source, string model) { External::sourceNode(source, _, model) }

predicate knownSinkModel(Node sink, string model) { none() }
predicate knownSinkModel(Node sink, string model) { External::sinkNode(sink, _, model) }

/**
* Holds if flow is allowed to pass from parameter `p` and back to itself as a
Expand Down
19 changes: 0 additions & 19 deletions go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,6 @@ class DataFlowCallable extends TDataFlowCallable {
result = this.asFileScope().getLocation() or
result = getCallableLocation(this.asSummarizedCallable())
}

/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
c.hasLocationInfo(file, startline, startcolumn, _, _)
|
c order by file, startline, startcolumn
)
}
}

private Location getCallableLocation(Callable c) {
Expand Down Expand Up @@ -420,15 +410,6 @@ class NodeRegion instanceof BasicBlock {
string toString() { result = "NodeRegion" }

predicate contains(Node n) { n.getBasicBlock() = this }

int totalOrder() {
this =
rank[result](BasicBlock b, int startline, int startcolumn |
b.hasLocationInfo(_, startline, startcolumn, _, _)
|
b order by startline, startcolumn
)
}
}

/**
Expand Down
47 changes: 10 additions & 37 deletions java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,18 @@ 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
)
/** Holds if `n1` is the qualifier of a call to `clone()` and `n2` is the result. */
predicate cloneStep(Node n1, Node n2) {
exists(MethodCall mc |
mc.getMethod() instanceof CloneMethod and
n1 = getInstanceArgument(mc) and
n2.asExpr() = mc
)
}

bindingset[node1, node2]
predicate validParameterAliasStep(Node node1, Node node2) { not cloneStep(node1, node2) }

private newtype TDataFlowCallable =
TSrcCallable(Callable c) or
TSummarizedCallable(SummarizedCallable c) or
Expand Down Expand Up @@ -448,28 +445,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) {
Expand Down Expand Up @@ -559,16 +538,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`. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,6 @@ abstract class DataFlowCallable extends TDataFlowCallable {

/** Gets the location of this dataflow callable. */
abstract Location getLocation();

/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
|
c order by file, startline, startcolumn
)
}
}

/** A callable function. */
Expand Down
10 changes: 0 additions & 10 deletions ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowDispatch.qll
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,6 @@ class DataFlowCallable extends TDataFlowCallable {
this instanceof TLibraryCallable and
result instanceof EmptyLocation
}

/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
|
c order by file, startline, startcolumn
)
}
}

/**
Expand Down
5 changes: 0 additions & 5 deletions shared/dataflow/codeql/dataflow/DataFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ signature module InputSig<LocationSig Location> {

/** Gets the location of this callable. */
Location getLocation();

/** Gets a best-effort total ordering. */
int totalorder();
}

class ReturnKind {
Expand Down Expand Up @@ -276,8 +273,6 @@ signature module InputSig<LocationSig Location> {
class NodeRegion {
/** Holds if this region contains `n`. */
predicate contains(Node n);

int totalOrder();
}

/**
Expand Down
10 changes: 0 additions & 10 deletions swift/ql/lib/codeql/swift/dataflow/internal/DataFlowDispatch.qll
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ class DataFlowCallable extends TDataFlowCallable {
Callable::TypeRange getUnderlyingCallable() {
result = this.asSummarizedCallable() or result = this.asSourceCallable()
}

/** Gets a best-effort total ordering. */
int totalorder() {
this =
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
|
c order by file, startline, startcolumn
)
}
}

cached
Expand Down

0 comments on commit 73ee8ef

Please sign in to comment.