Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift: upgrade to 5.9 #14261

Merged
merged 8 commits into from
Nov 8, 2023
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
2,642 changes: 2,642 additions & 0 deletions swift/downgrades/fcc7b497930add320fabeed9b228b264bc847ae6/old.dbscheme

Large diffs are not rendered by default.

2,636 changes: 2,636 additions & 0 deletions swift/downgrades/fcc7b497930add320fabeed9b228b264bc847ae6/swift.dbscheme

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Converts SingleValueStmtExprs into UnspecifiedElements
class Element extends @element {
string toString() { none() }
}

from Element e, string property, string error
where
single_value_stmt_exprs(e, _) and
property = "" and
error = "Removed SingleValueStmtExpr during the database downgrade"
or
unspecified_elements(e, property, error)
select e, property, error
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Removing SingleValueStmtExpr
compatibility: partial

unspecified_elements.rel: run unspecified_elements.ql
single_value_stmt_exprs.rel: delete
2 changes: 1 addition & 1 deletion swift/extractor/infra/SwiftTagTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ MAP(swift::Expr, ExprTag)
MAP(swift::CopyExpr, void) // TODO (introduced in 5.9)
MAP(swift::ConsumeExpr, void) // TODO (introduced in 5.9)
MAP(swift::MaterializePackExpr, void) // TODO (introduced in 5.9)
MAP(swift::SingleValueStmtExpr, void) // TODO (introduced in 5.9)
MAP(swift::SingleValueStmtExpr, SingleValueStmtExprTag)
#endif

MAP(swift::Decl, DeclTag)
Expand Down
7 changes: 7 additions & 0 deletions swift/extractor/translators/ExprTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,4 +636,11 @@ codeql::RegexLiteralExpr ExprTranslator::translateRegexLiteralExpr(
return entry;
}

codeql::SingleValueStmtExpr ExprTranslator::translateSingleValueStmtExpr(
const swift::SingleValueStmtExpr& expr) {
auto entry = createExprEntry(expr);
entry.stmt = dispatcher.fetchLabel(expr.getStmt());
return entry;
}

} // namespace codeql
1 change: 1 addition & 0 deletions swift/extractor/translators/ExprTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class ExprTranslator : public AstTranslatorBase<ExprTranslator> {
codeql::AppliedPropertyWrapperExpr translateAppliedPropertyWrapperExpr(
const swift::AppliedPropertyWrapperExpr& expr);
codeql::RegexLiteralExpr translateRegexLiteralExpr(const swift::RegexLiteralExpr& expr);
codeql::SingleValueStmtExpr translateSingleValueStmtExpr(const swift::SingleValueStmtExpr& expr);

private:
void fillClosureExpr(const swift::AbstractClosureExpr& expr, codeql::ClosureExpr& entry);
Expand Down
15 changes: 10 additions & 5 deletions swift/ql/.generated.list

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions swift/ql/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions swift/ql/lib/change-notes/2023-11-08-swift-5.9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
category: majorAnalysis
---
* Added Swift 5.9.1 support
* New AST node is extracted: `SingleValueStmtExpr`
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,15 @@ module Exprs {
}
}

/** Control-flow for a `SingleValueStmtExpr`. See the QLDoc for `SingleValueStmtExpr` for the semantics of a `SingleValueStmtExpr`. */
private class SingleValueStmtExprTree extends AstStandardPostOrderTree {
override SingleValueStmtExpr ast;

final override ControlFlowElement getChildElement(int i) {
i = 0 and result.asAstNode() = ast.getStmt()
}
}

private class OpaqueValueExprTree extends AstLeafTree {
override OpaqueValueExpr ast;
}
Expand Down
1 change: 1 addition & 0 deletions swift/ql/lib/codeql/swift/elements.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions swift/ql/lib/codeql/swift/generated/ParentChild.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions swift/ql/lib/codeql/swift/generated/Raw.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 28 additions & 2 deletions swift/ql/lib/codeql/swift/generated/Synth.qll

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading