Swift: Adapt to FlowSummaryImpl changes · computersarebad/codeql@c37ef24 · GitHub
Skip to content

Commit c37ef24

Browse files
committed
Swift: Adapt to FlowSummaryImpl changes
1 parent 0abb038 commit c37ef24

3 files changed

Lines changed: 30 additions & 20 deletions

File tree

‎swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll‎

Lines changed: 4 additions & 6 deletions

‎swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll‎

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,20 @@ module Input implements InputSig<Location, DataFlowImplSpecific::SwiftDataFlow>
1616

1717
class SummarizedCallableBase = Function;
1818

19-
class SourceBase = Void;
19+
class SourceBase extends Void {
20+
Location getLocation() { none() }
21+
}
2022

21-
class SinkBase = Void;
23+
class SinkBase = SourceBase;
2224

23-
class FlowSummaryCallBase = Void;
25+
class FlowSummaryCallBase = SourceBase;
2426

2527
predicate callableFromSource(SummarizedCallableBase c) { c.hasBody() }
2628

29+
DataFlowCallable getSummarizedCallableAsDataFlowCallable(SummarizedCallableBase c) {
30+
result.asSummarizedCallable() = c
31+
}
32+
2733
ArgumentPosition callbackSelfParameterPosition() { result instanceof ThisArgumentPosition }
2834

2935
ReturnKind getStandardReturnValueKind() { result instanceof NormalReturnKind }
@@ -114,18 +120,24 @@ module Input implements InputSig<Location, DataFlowImplSpecific::SwiftDataFlow>
114120

115121
private import Make<Location, DataFlowImplSpecific::SwiftDataFlow, Input> as Impl
116122

117-
private module StepsInput implements Impl::Private::StepsInputSig {
118-
Impl::Private::SummaryNode getSummaryNode(Node n) {
119-
result = n.(FlowSummaryNode).getSummaryNode()
120-
}
123+
private module Input2 implements Impl::Private::InputSig2 {
124+
private import codeql.util.Void
121125

122-
DataFlowCall getACall(Public::SummarizedCallable sc) { result.asCall().getStaticTarget() = sc }
126+
class SourceSinkReportingElement extends Void {
127+
Location getLocation() { none() }
123128

124-
DataFlowCallable getSourceNodeEnclosingCallable(Input::SourceBase source) { none() }
129+
DataFlowCallable getEnclosingCallable() { none() }
125130

126-
Node getSourceNode(Input::SourceBase source, Impl::Private::SummaryComponentStack s) { none() }
131+
SourceSinkReportingElement getASuccessor(Impl::Private::SummaryComponent sc) { none() }
132+
}
133+
}
134+
135+
private import Impl::Private::Make2<Input2> as Impl2
127136

128-
Node getSinkNode(Input::SinkBase sink, Impl::Private::SummaryComponent sc) { none() }
137+
private module StepsInput implements Impl2::StepsInputSig {
138+
Impl2::SummaryNode getSummaryNode(Node n) { result = n.(FlowSummaryNode).getSummaryNode() }
139+
140+
DataFlowCall getACall(Public::SummarizedCallable sc) { result.asCall().getStaticTarget() = sc }
129141
}
130142

131143
module SourceSinkInterpretationInput implements
@@ -252,8 +264,9 @@ module SourceSinkInterpretationInput implements
252264

253265
module Private {
254266
import Impl::Private
267+
import Impl2
255268

256-
module Steps = Impl::Private::Steps<StepsInput>;
269+
module Steps = Impl2::Steps<StepsInput>;
257270

258271
module External {
259272
import Impl::Private::External

‎swift/ql/lib/codeql/swift/dataflow/internal/TaintTrackingPrivate.qll‎

Lines changed: 1 addition & 2 deletions

0 commit comments

Comments
 (0)