Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions swift/extractor/translators/PatternTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ namespace codeql {

codeql::NamedPattern PatternTranslator::translateNamedPattern(const swift::NamedPattern& pattern) {
auto entry = dispatcher.createEntry(pattern);
// TODO: in some (but not all) cases, this seems to introduce a duplicate entry
// for example the vars listed in a case stmt have a different pointer than then ones in
// patterns.
// assert(pattern.getDecl() && "expect NamedPattern to have Decl");
// dispatcher.emit(NamedPatternsTrap{label, pattern.getNameStr().str(),
// dispatcher.fetchLabel(pattern.getDecl())});
entry.name = pattern.getNameStr().str();
return entry;
}
Expand Down
4 changes: 1 addition & 3 deletions swift/ql/lib/codeql/swift/dataflow/Ssa.qll
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ module Ssa {
*/
cached
predicate assigns(CfgNode value) {
exists(
AssignExpr a, SsaInput::BasicBlock bb, int i // TODO: use CFG node for assignment expr
|
exists(AssignExpr a, SsaInput::BasicBlock bb, int i |
this.definesAt(_, bb, i) and
a = bb.getNode(i).getNode().asAstNode() and
value.getNode().asAstNode() = a.getSource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ class PropertyObserverCall extends DataFlowCall, TPropertyObserverCall {
i = -1 and
result = observer.getBase()
or
// TODO: This is correct for `willSet` (which takes a `newValue` parameter),
// but for `didSet` (which takes an `oldValue` parameter) we need an rvalue
// for `getBase()`.
i = 0 and
result = observer.getSource()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,6 @@ private module ArgumentNodes {
ObserverArgumentNode() {
observer.getBase() = this.getCfgNode()
or
// TODO: This should be an rvalue representing the `getBase` when
// `observer` a `didSet` observer.
observer.getSource() = this.getCfgNode()
}

Expand All @@ -444,7 +442,6 @@ private module ArgumentNodes {
pos = TThisArgument() and
observer.getBase() = this.getCfgNode()
or
// TODO: See the comment above for `didSet` observers.
pos.(PositionalArgumentPosition).getIndex() = 0 and
observer.getSource() = this.getCfgNode()
)
Expand Down Expand Up @@ -683,14 +680,14 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
// i.e. from `f(x)` where `x: T` into `f(.some(x))` where the context `f` expects a `T?`.
exists(InjectIntoOptionalExpr e |
e.convertsFrom(node1.asExpr()) and
node2 = node1 and // HACK: we should ideally have a separate Node case for the (hidden) InjectIntoOptionalExpr
node2 = node1 and // TODO: we should ideally have a separate Node case for the (hidden) InjectIntoOptionalExpr
c instanceof OptionalSomeContentSet
)
or
// creation of an optional by returning from a failable initializer (`init?`)
exists(Initializer init |
node1.asExpr().(CallExpr).getStaticTarget() = init and
node2 = node1 and // HACK: again, we should ideally have a separate Node case here, and not reuse the CallExpr
node2 = node1 and // TODO: again, we should ideally have a separate Node case here, and not reuse the CallExpr
c instanceof OptionalSomeContentSet and
init.isFailable()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,19 @@ DataFlowType getContentType(ContentSet c) { any() }

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

/**
* Gets the type of the parameter matching arguments at position `pos` in a
* synthesized call that targets a callback of type `t`.
*/
DataFlowType getCallbackParameterType(DataFlowType t, ArgumentPosition pos) {
any() // TODO once we have type pruning
}
DataFlowType getCallbackParameterType(DataFlowType t, ArgumentPosition pos) { any() }

/**
* Gets the return type of kind `rk` in a synthesized call that targets a
* callback of type `t`.
*/
DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) {
any() // TODO once we have type pruning
}
DataFlowType getCallbackReturnType(DataFlowType t, ReturnKind rk) { any() }

/** Gets the type of synthetic global `sg`. */
DataFlowType getSyntheticGlobalType(SummaryComponent::SyntheticGlobal sg) { any() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ private class CustomUrlRemoteFlowSource extends SourceModelCsv {
";UIApplicationDelegate;true;application(_:open:options:);;;Parameter[1];remote",
";UIApplicationDelegate;true;application(_:handleOpen:);;;Parameter[1];remote",
";UIApplicationDelegate;true;application(_:open:sourceApplication:annotation:);;;Parameter[1];remote",
// TODO 1: The actual source is the value of `UIApplication.LaunchOptionsKey.url` in the launchOptions dictionary.
// Use dictionary value contents when available.
// ";UIApplicationDelegate;true;application(_:didFinishLaunchingWithOptions:);;;Parameter[1].MapValue;remote",
// ";UIApplicationDelegate;true;application(_:willFinishLaunchingWithOptions:);;;Parameter[1].MapValue;remote"
";UISceneDelegate;true;scene(_:continue:);;;Parameter[1];remote",
";UISceneDelegate;true;scene(_:didUpdate:);;;Parameter[1];remote",
";UISceneDelegate;true;scene(_:openURLContexts:);;;Parameter[1];remote",
Expand All @@ -36,7 +32,6 @@ private class CustomUrlRemoteFlowSource extends SourceModelCsv {
* `UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:)` or
* `UIApplicationDelegate.application(_:willFinishLaunchingWithOptions:)`.
*/
// This is a temporary workaround until the TODO 1 above is addressed.
private class UrlLaunchOptionsRemoteFlowSource extends RemoteFlowSource {
UrlLaunchOptionsRemoteFlowSource() {
exists(ApplicationWithLaunchOptionsFunc f, SubscriptExpr e |
Expand Down