Skip to content

Commit

Permalink
Merge pull request #14261 from github/alexdenisov/upgrade-to-swift-5.9
Browse files Browse the repository at this point in the history
Swift: upgrade to 5.9
  • Loading branch information
redsun82 authored Nov 8, 2023
2 parents 512c6a5 + d8e75e6 commit e68826b
Show file tree
Hide file tree
Showing 40 changed files with 10,807 additions and 105 deletions.
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.

1 change: 1 addition & 0 deletions swift/ql/lib/codeql/swift/generated/SynthConstructors.qll

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

24 changes: 24 additions & 0 deletions swift/ql/lib/codeql/swift/generated/expr/SingleValueStmtExpr.qll

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

Loading

0 comments on commit e68826b

Please sign in to comment.