Skip to content

Commit

Permalink
Swift: extract SingleValueStmtExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Denisov committed Oct 17, 2023
1 parent 868429b commit 0476639
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 8 deletions.
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
14 changes: 9 additions & 5 deletions swift/ql/.generated.list

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

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

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/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.

12 changes: 12 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.

21 changes: 21 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.

6 changes: 6 additions & 0 deletions swift/ql/lib/swift.dbscheme

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.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
deadEnd
| alamofire.swift:469:9:469:9 | stream |
| alamofire.swift:484:9:484:9 | stream |
| alamofire.swift:499:9:499:9 | stream |
| alamofire.swift:514:9:514:9 | stream |
4 changes: 4 additions & 0 deletions swift/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,3 +1225,7 @@ class ParameterizedProtocolType(Type):

class AbiSafeConversionExpr(ImplicitConversionExpr):
pass


class SingleValueStmtExpr(Expr):
stmt: Stmt | child

0 comments on commit 0476639

Please sign in to comment.