Skip to content

Commit 599411b

Browse files
authored
Merge pull request #17787 from yoff/shared/add-location-to-typetracking-nodes
shared: Add locations to type tracking nodes
2 parents 6b182c5 + f02995d commit 599411b

File tree

8 files changed

+22
-14
lines changed

8 files changed

+22
-14
lines changed

java/ql/lib/semmle/code/java/dispatch/DispatchFlow.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ private module TrackLambda<methodDispatchSig/1 lambdaDispatch0> {
334334
)
335335
}
336336

337-
private module TtInput implements TypeTrackingInput {
337+
private module TtInput implements TypeTrackingInput<Location> {
338338
import TypeTrackingSteps
339339

340340
predicate callStep(Node n1, LocalSourceNode n2) { argParamCand(n1, n2) }
@@ -348,7 +348,7 @@ private module TrackLambda<methodDispatchSig/1 lambdaDispatch0> {
348348
}
349349
}
350350

351-
private import TypeTracking<TtInput>::TypeTrack<lambdaSource/1>::Graph<lambdaSink/1>
351+
private import TypeTracking<Location, TtInput>::TypeTrack<lambdaSource/1>::Graph<lambdaSink/1>
352352

353353
private predicate edgePlus(PathNode n1, PathNode n2) = fastTC(edges/2)(n1, n2)
354354

python/ql/lib/semmle/python/dataflow/new/TypeTracking.qll

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55

66
private import internal.TypeTrackingImpl as Impl
7-
import Impl::Shared::TypeTracking<Impl::TypeTrackingInput>
7+
private import semmle.python.Files
8+
import Impl::Shared::TypeTracking<Location, Impl::TypeTrackingInput>
89
private import semmle.python.dataflow.new.internal.DataFlowPublic as DataFlowPublic
910

1011
/**

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private module SummaryTypeTrackerInput implements SummaryTypeTracker::Input {
106106

107107
private module TypeTrackerSummaryFlow = SummaryTypeTracker::SummaryFlow<SummaryTypeTrackerInput>;
108108

109-
module TypeTrackingInput implements Shared::TypeTrackingInput {
109+
module TypeTrackingInput implements Shared::TypeTrackingInput<Location> {
110110
class Node = DataFlowPublic::Node;
111111

112112
class LocalSourceNode = DataFlowPublic::LocalSourceNode;
@@ -323,4 +323,4 @@ module TypeTrackingInput implements Shared::TypeTrackingInput {
323323
predicate nonStandardFlowsTo(LocalSourceNode localSource, Node dst) { localSource.flowsTo(dst) }
324324
}
325325

326-
import SharedImpl::TypeTracking<TypeTrackingInput>
326+
import SharedImpl::TypeTracking<Location, TypeTrackingInput>

ruby/ql/lib/codeql/ruby/typetracking/TypeTracking.qll

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
* for tracking types.
44
*/
55

6+
private import codeql.ruby.AST
67
private import codeql.ruby.typetracking.internal.TypeTrackingImpl as Impl
7-
import Impl::Shared::TypeTracking<Impl::TypeTrackingInput>
8+
import Impl::Shared::TypeTracking<Location, Impl::TypeTrackingInput>

ruby/ql/lib/codeql/ruby/typetracking/internal/TypeTrackingImpl.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private module TypeTrackerSummaryFlow = SummaryTypeTracker::SummaryFlow<SummaryT
265265

266266
private newtype TContentFilter = MkElementFilter()
267267

268-
module TypeTrackingInput implements Shared::TypeTrackingInput {
268+
module TypeTrackingInput implements Shared::TypeTrackingInput<Location> {
269269
class Node = DataFlowPublic::Node;
270270

271271
class LocalSourceNode = DataFlowPublic::LocalSourceNode;
@@ -467,4 +467,4 @@ module TypeTrackingInput implements Shared::TypeTrackingInput {
467467
predicate hasFeatureBacktrackStoreTarget() { none() }
468468
}
469469

470-
import SharedImpl::TypeTracking<TypeTrackingInput>
470+
import SharedImpl::TypeTracking<Location, TypeTrackingInput>

shared/dataflow/codeql/dataflow/internal/DataFlowImplCommon.qll

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
8080
}
8181
}
8282

83-
private module TypeTrackingInput implements Tt::TypeTrackingInput {
83+
private module TypeTrackingInput implements Tt::TypeTrackingInput<Location> {
8484
final class Node = Lang::Node;
8585

8686
class LocalSourceNode extends Node {
@@ -145,7 +145,7 @@ module MakeImplCommon<LocationSig Location, InputSig<Location> Lang> {
145145
predicate hasFeatureBacktrackStoreTarget() { none() }
146146
}
147147

148-
private module TypeTracking = Tt::TypeTracking<TypeTrackingInput>;
148+
private module TypeTracking = Tt::TypeTracking<Location, TypeTrackingInput>;
149149

150150
/**
151151
* The cost limits for the `AccessPathFront` to `AccessPathApprox` expansion.

shared/typetracking/codeql/typetracking/TypeTracking.qll

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
* for tracking types.
44
*/
55

6+
private import codeql.util.Location
7+
68
/**
79
* The step relations for type tracking.
810
*/
9-
signature module TypeTrackingInput {
11+
signature module TypeTrackingInput<LocationSig Location> {
1012
/** A node that is used by the type-trackers. */
1113
class Node {
1214
/** Gets a textual representation of this node. */
1315
string toString();
16+
17+
/** Gets the source location of this node. */
18+
Location getLocation();
1419
}
1520

1621
/**
@@ -127,8 +132,8 @@ private import internal.TypeTrackingImpl as Impl
127132
* Given a set of step relations, this module provides classes and predicates
128133
* for simple data-flow reachability suitable for tracking types.
129134
*/
130-
module TypeTracking<TypeTrackingInput I> {
131-
private module MkImpl = Impl::TypeTracking<I>;
135+
module TypeTracking<LocationSig Location, TypeTrackingInput<Location> I> {
136+
private module MkImpl = Impl::TypeTracking<Location, I>;
132137

133138
private module ConsistencyChecksInput implements MkImpl::ConsistencyChecksInputSig { }
134139

shared/typetracking/codeql/typetracking/internal/TypeTrackingImpl.qll

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
private import codeql.util.Boolean
77
private import codeql.util.Option
88
private import codeql.typetracking.TypeTracking
9+
private import codeql.util.Location
910

1011
/**
1112
* Given a set of step relations, this module provides classes and predicates
@@ -14,7 +15,7 @@ private import codeql.typetracking.TypeTracking
1415
* The constructed module contains both public and internal logic; the public
1516
* interface is exposed via `codeql.typetracking.TypeTracking`.
1617
*/
17-
module TypeTracking<TypeTrackingInput I> {
18+
module TypeTracking<LocationSig Location, TypeTrackingInput<Location> I> {
1819
private import I
1920

2021
signature module ConsistencyChecksInputSig {

0 commit comments

Comments
 (0)