Skip to content

Commit 73ee8ef

Browse files
author
Dilan Bhalla
committed
2.18.1 merge conflict
1 parent db6fb7b commit 73ee8ef

File tree

7 files changed

+13
-112
lines changed

7 files changed

+13
-112
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ private import Node0ToString
1111
private import ModelUtil
1212
private import semmle.code.cpp.models.interfaces.FunctionInputsAndOutputs as IO
1313
private import semmle.code.cpp.models.interfaces.DataFlow as DF
14+
private import semmle.code.cpp.dataflow.ExternalFlow as External
1415

1516
cached
1617
private module Cached {
@@ -1060,16 +1061,6 @@ class DataFlowCallable extends TDataFlowCallable {
10601061
result = this.asSummarizedCallable() or // SummarizedCallable = Function (in CPP)
10611062
result = this.asSourceCallable()
10621063
}
1063-
1064-
/** Gets a best-effort total ordering. */
1065-
int totalorder() {
1066-
this =
1067-
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
1068-
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
1069-
|
1070-
c order by file, startline, startcolumn
1071-
)
1072-
}
10731064
}
10741065

10751066
/**
@@ -1276,15 +1267,6 @@ module IsUnreachableInCall {
12761267
string toString() { result = "NodeRegion" }
12771268

12781269
predicate contains(Node n) { this = n.getBasicBlock() }
1279-
1280-
int totalOrder() {
1281-
this =
1282-
rank[result](IRBlock b, int startline, int startcolumn |
1283-
b.getLocation().hasLocationInfo(_, startline, startcolumn, _, _)
1284-
|
1285-
b order by startline, startcolumn
1286-
)
1287-
}
12881270
}
12891271

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

1372-
predicate knownSourceModel(Node source, string model) { none() }
1354+
predicate knownSourceModel(Node source, string model) { External::sourceNode(source, _, model) }
13731355

1374-
predicate knownSinkModel(Node sink, string model) { none() }
1356+
predicate knownSinkModel(Node sink, string model) { External::sinkNode(sink, _, model) }
13751357

13761358
/**
13771359
* Holds if flow is allowed to pass from parameter `p` and back to itself as a

go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,6 @@ class DataFlowCallable extends TDataFlowCallable {
318318
result = this.asFileScope().getLocation() or
319319
result = getCallableLocation(this.asSummarizedCallable())
320320
}
321-
322-
/** Gets a best-effort total ordering. */
323-
int totalorder() {
324-
this =
325-
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
326-
c.hasLocationInfo(file, startline, startcolumn, _, _)
327-
|
328-
c order by file, startline, startcolumn
329-
)
330-
}
331321
}
332322

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

422412
predicate contains(Node n) { n.getBasicBlock() = this }
423-
424-
int totalOrder() {
425-
this =
426-
rank[result](BasicBlock b, int startline, int startcolumn |
427-
b.hasLocationInfo(_, startline, startcolumn, _, _)
428-
|
429-
b order by startline, startcolumn
430-
)
431-
}
432413
}
433414

434415
/**

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -400,21 +400,18 @@ class CastNode extends ExprNode {
400400
}
401401
}
402402

403-
private predicate id_member(Member x, Member y) { x = y }
404-
405-
private predicate idOf_member(Member x, int y) = equivalenceRelation(id_member/2)(x, y)
406-
407-
private int summarizedCallableId(SummarizedCallable c) {
408-
c =
409-
rank[result](SummarizedCallable c0, int b, int i, string s |
410-
b = 0 and idOf_member(c0.asCallable(), i) and s = ""
411-
or
412-
b = 1 and i = 0 and s = c0.asSyntheticCallable()
413-
|
414-
c0 order by b, i, s
415-
)
403+
/** Holds if `n1` is the qualifier of a call to `clone()` and `n2` is the result. */
404+
predicate cloneStep(Node n1, Node n2) {
405+
exists(MethodCall mc |
406+
mc.getMethod() instanceof CloneMethod and
407+
n1 = getInstanceArgument(mc) and
408+
n2.asExpr() = mc
409+
)
416410
}
417411

412+
bindingset[node1, node2]
413+
predicate validParameterAliasStep(Node node1, Node node2) { not cloneStep(node1, node2) }
414+
418415
private newtype TDataFlowCallable =
419416
TSrcCallable(Callable c) or
420417
TSummarizedCallable(SummarizedCallable c) or
@@ -448,28 +445,10 @@ class DataFlowCallable extends TDataFlowCallable {
448445
result = this.asSummarizedCallable().getLocation() or
449446
result = this.asFieldScope().getLocation()
450447
}
451-
452-
/** Gets a best-effort total ordering. */
453-
int totalorder() {
454-
this =
455-
rank[result](DataFlowCallable c, int b, int i |
456-
b = 0 and idOf_member(c.asCallable(), i)
457-
or
458-
b = 1 and i = summarizedCallableId(c.asSummarizedCallable())
459-
or
460-
b = 2 and idOf_member(c.asFieldScope(), i)
461-
|
462-
c order by b, i
463-
)
464-
}
465448
}
466449

467450
class DataFlowExpr = Expr;
468451

469-
private predicate id_call(Call x, Call y) { x = y }
470-
471-
private predicate idOf_call(Call x, int y) = equivalenceRelation(id_call/2)(x, y)
472-
473452
private newtype TDataFlowCall =
474453
TCall(Call c) or
475454
TSummaryCall(SummarizedCallable c, FlowSummaryImpl::Private::SummaryNode receiver) {
@@ -559,16 +538,10 @@ class SummaryCall extends DataFlowCall, TSummaryCall {
559538
override Location getLocation() { result = c.getLocation() }
560539
}
561540

562-
private predicate id(BasicBlock x, BasicBlock y) { x = y }
563-
564-
private predicate idOf(BasicBlock x, int y) = equivalenceRelation(id/2)(x, y)
565-
566541
class NodeRegion instanceof BasicBlock {
567542
string toString() { result = "NodeRegion" }
568543

569544
predicate contains(Node n) { n.asExpr().getBasicBlock() = this }
570-
571-
int totalOrder() { idOf(this, result) }
572545
}
573546

574547
/** Holds if `e` is an expression that always has the same Boolean value `val`. */

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,6 @@ abstract class DataFlowCallable extends TDataFlowCallable {
344344

345345
/** Gets the location of this dataflow callable. */
346346
abstract Location getLocation();
347-
348-
/** Gets a best-effort total ordering. */
349-
int totalorder() {
350-
this =
351-
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
352-
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
353-
|
354-
c order by file, startline, startcolumn
355-
)
356-
}
357347
}
358348

359349
/** A callable function. */

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,6 @@ class DataFlowCallable extends TDataFlowCallable {
113113
this instanceof TLibraryCallable and
114114
result instanceof EmptyLocation
115115
}
116-
117-
/** Gets a best-effort total ordering. */
118-
int totalorder() {
119-
this =
120-
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
121-
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
122-
|
123-
c order by file, startline, startcolumn
124-
)
125-
}
126116
}
127117

128118
/**

shared/dataflow/codeql/dataflow/DataFlow.qll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ signature module InputSig<LocationSig Location> {
9797

9898
/** Gets the location of this callable. */
9999
Location getLocation();
100-
101-
/** Gets a best-effort total ordering. */
102-
int totalorder();
103100
}
104101

105102
class ReturnKind {
@@ -276,8 +273,6 @@ signature module InputSig<LocationSig Location> {
276273
class NodeRegion {
277274
/** Holds if this region contains `n`. */
278275
predicate contains(Node n);
279-
280-
int totalOrder();
281276
}
282277

283278
/**

swift/ql/lib/codeql/swift/dataflow/internal/DataFlowDispatch.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ class DataFlowCallable extends TDataFlowCallable {
6565
Callable::TypeRange getUnderlyingCallable() {
6666
result = this.asSummarizedCallable() or result = this.asSourceCallable()
6767
}
68-
69-
/** Gets a best-effort total ordering. */
70-
int totalorder() {
71-
this =
72-
rank[result](DataFlowCallable c, string file, int startline, int startcolumn |
73-
c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _)
74-
|
75-
c order by file, startline, startcolumn
76-
)
77-
}
7868
}
7969

8070
cached

0 commit comments

Comments
 (0)