Skip to content

Commit 87325db

Browse files
authored
Merge pull request github#13112 from geoffw0/swifttodos2
Swift: Delete some more TODO comments.
2 parents d299ef0 + 1820d36 commit 87325db

File tree

6 files changed

+6
-31
lines changed

6 files changed

+6
-31
lines changed

swift/extractor/translators/PatternTranslator.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ namespace codeql {
44

55
codeql::NamedPattern PatternTranslator::translateNamedPattern(const swift::NamedPattern& pattern) {
66
auto entry = dispatcher.createEntry(pattern);
7-
// TODO: in some (but not all) cases, this seems to introduce a duplicate entry
8-
// for example the vars listed in a case stmt have a different pointer than then ones in
9-
// patterns.
10-
// assert(pattern.getDecl() && "expect NamedPattern to have Decl");
11-
// dispatcher.emit(NamedPatternsTrap{label, pattern.getNameStr().str(),
12-
// dispatcher.fetchLabel(pattern.getDecl())});
137
entry.name = pattern.getNameStr().str();
148
return entry;
159
}

swift/ql/lib/codeql/swift/dataflow/Ssa.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,7 @@ module Ssa {
184184
*/
185185
cached
186186
predicate assigns(CfgNode value) {
187-
exists(
188-
AssignExpr a, SsaInput::BasicBlock bb, int i // TODO: use CFG node for assignment expr
189-
|
187+
exists(AssignExpr a, SsaInput::BasicBlock bb, int i |
190188
this.definesAt(_, bb, i) and
191189
a = bb.getNode(i).getNode().asAstNode() and
192190
value.getNode().asAstNode() = a.getSource()

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,6 @@ class PropertyObserverCall extends DataFlowCall, TPropertyObserverCall {
215215
i = -1 and
216216
result = observer.getBase()
217217
or
218-
// TODO: This is correct for `willSet` (which takes a `newValue` parameter),
219-
// but for `didSet` (which takes an `oldValue` parameter) we need an rvalue
220-
// for `getBase()`.
221218
i = 0 and
222219
result = observer.getSource()
223220
}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,6 @@ private module ArgumentNodes {
433433
ObserverArgumentNode() {
434434
observer.getBase() = this.getCfgNode()
435435
or
436-
// TODO: This should be an rvalue representing the `getBase` when
437-
// `observer` a `didSet` observer.
438436
observer.getSource() = this.getCfgNode()
439437
}
440438

@@ -444,7 +442,6 @@ private module ArgumentNodes {
444442
pos = TThisArgument() and
445443
observer.getBase() = this.getCfgNode()
446444
or
447-
// TODO: See the comment above for `didSet` observers.
448445
pos.(PositionalArgumentPosition).getIndex() = 0 and
449446
observer.getSource() = this.getCfgNode()
450447
)
@@ -683,14 +680,14 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
683680
// i.e. from `f(x)` where `x: T` into `f(.some(x))` where the context `f` expects a `T?`.
684681
exists(InjectIntoOptionalExpr e |
685682
e.convertsFrom(node1.asExpr()) and
686-
node2 = node1 and // HACK: we should ideally have a separate Node case for the (hidden) InjectIntoOptionalExpr
683+
node2 = node1 and // TODO: we should ideally have a separate Node case for the (hidden) InjectIntoOptionalExpr
687684
c instanceof OptionalSomeContentSet
688685
)
689686
or
690687
// creation of an optional by returning from a failable initializer (`init?`)
691688
exists(Initializer init |
692689
node1.asExpr().(CallExpr).getStaticTarget() = init and
693-
node2 = node1 and // HACK: again, we should ideally have a separate Node case here, and not reuse the CallExpr
690+
node2 = node1 and // TODO: again, we should ideally have a separate Node case here, and not reuse the CallExpr
694691
c instanceof OptionalSomeContentSet and
695692
init.isFailable()
696693
)

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,19 @@ DataFlowType getContentType(ContentSet c) { any() }
3131

3232
/** Gets the return type of kind `rk` for callable `c`. */
3333
bindingset[c]
34-
DataFlowType getReturnType(SummarizedCallable c, ReturnKind rk) {
35-
any() // TODO once we have type pruning
36-
}
34+
DataFlowType getReturnType(SummarizedCallable c, ReturnKind rk) { any() }
3735

3836
/**
3937
* Gets the type of the parameter matching arguments at position `pos` in a
4038
* synthesized call that targets a callback of type `t`.
4139
*/
42-
DataFlowType getCallbackParameterType(DataFlowType t, ArgumentPosition pos) {
43-
any() // TODO once we have type pruning
44-
}
40+
DataFlowType getCallbackParameterType(DataFlowType t, ArgumentPosition pos) { any() }
4541

4642
/**
4743
* Gets the return type of kind `rk` in a synthesized call that targets a
4844
* callback of type `t`.
4945
*/
50-
DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) {
51-
any() // TODO once we have type pruning
52-
}
46+
DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) { any() }
5347

5448
/** Gets the type of synthetic global `sg`. */
5549
DataFlowType getSyntheticGlobalType(SummaryComponent::SyntheticGlobal sg) { any() }

swift/ql/lib/codeql/swift/frameworks/StandardLibrary/CustomUrlSchemes.qll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ private class CustomUrlRemoteFlowSource extends SourceModelCsv {
1919
";UIApplicationDelegate;true;application(_:open:options:);;;Parameter[1];remote",
2020
";UIApplicationDelegate;true;application(_:handleOpen:);;;Parameter[1];remote",
2121
";UIApplicationDelegate;true;application(_:open:sourceApplication:annotation:);;;Parameter[1];remote",
22-
// TODO 1: The actual source is the value of `UIApplication.LaunchOptionsKey.url` in the launchOptions dictionary.
23-
// Use dictionary value contents when available.
24-
// ";UIApplicationDelegate;true;application(_:didFinishLaunchingWithOptions:);;;Parameter[1].MapValue;remote",
25-
// ";UIApplicationDelegate;true;application(_:willFinishLaunchingWithOptions:);;;Parameter[1].MapValue;remote"
2622
";UISceneDelegate;true;scene(_:continue:);;;Parameter[1];remote",
2723
";UISceneDelegate;true;scene(_:didUpdate:);;;Parameter[1];remote",
2824
";UISceneDelegate;true;scene(_:openURLContexts:);;;Parameter[1];remote",
@@ -36,7 +32,6 @@ private class CustomUrlRemoteFlowSource extends SourceModelCsv {
3632
* `UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:)` or
3733
* `UIApplicationDelegate.application(_:willFinishLaunchingWithOptions:)`.
3834
*/
39-
// This is a temporary workaround until the TODO 1 above is addressed.
4035
private class UrlLaunchOptionsRemoteFlowSource extends RemoteFlowSource {
4136
UrlLaunchOptionsRemoteFlowSource() {
4237
exists(ApplicationWithLaunchOptionsFunc f, SubscriptExpr e |

0 commit comments

Comments
 (0)