Skip to content

Commit 408e7ad

Browse files
authored
Merge pull request github#13678 from github/alexdenisov/5.9-preparation
Swift: 5.9 preparation
2 parents 44f23bf + c517fc6 commit 408e7ad

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

swift/extractor/infra/SwiftTagTraits.h

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <swift/AST/Pattern.h>
1313
#include <swift/AST/TypeRepr.h>
1414
#include <swift/AST/Type.h>
15+
#include <swift/CodeQLSwiftVersion.h>
1516

1617
namespace codeql {
1718

@@ -26,6 +27,9 @@ namespace codeql {
2627
using type = TAG; \
2728
};
2829

30+
#define CODEQL_SWIFT_VERSION_GE(MAJOR, MINOR) \
31+
CODEQL_SWIFT_VERSION_MAJOR >= (MAJOR) && CODEQL_SWIFT_VERSION_MINOR >= (MINOR)
32+
2933
// clang-format off
3034
// use indentation to recreate all involved type hierarchies
3135
MAP(std::filesystem::path, DbFileTag)
@@ -56,6 +60,9 @@ MAP(swift::Stmt, StmtTag)
5660
MAP(swift::FailStmt, FailStmtTag)
5761
MAP(swift::ThrowStmt, ThrowStmtTag)
5862
MAP(swift::PoundAssertStmt, PoundAssertStmtTag)
63+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
64+
MAP(swift::DiscardStmt, void) // TODO (introduced in 5.9)
65+
#endif
5966

6067
MAP(swift::Argument, ArgumentTag)
6168
MAP(swift::KeyPathExpr::Component, KeyPathComponentTag)
@@ -95,7 +102,11 @@ MAP(swift::Expr, ExprTag)
95102
MAP(swift::IdentityExpr, IdentityExprTag)
96103
MAP(swift::ParenExpr, ParenExprTag)
97104
MAP(swift::DotSelfExpr, DotSelfExprTag)
98-
MAP(swift::MoveExpr, void) // TODO (introduced in 5.8)
105+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
106+
MAP(swift::BorrowExpr, void) // TODO (introduced in 5.9)
107+
#else
108+
MAP(swift::MoveExpr, void) // TODO (introduced in 5.8, gone in 5.9)
109+
#endif
99110
MAP(swift::AwaitExpr, AwaitExprTag)
100111
MAP(swift::UnresolvedMemberChainResultExpr, UnresolvedMemberChainResultExprTag)
101112
MAP(swift::AnyTryExpr, AnyTryExprTag)
@@ -189,6 +200,13 @@ MAP(swift::Expr, ExprTag)
189200
MAP(swift::TapExpr, TapExprTag)
190201
MAP(swift::TypeJoinExpr, void) // TODO (introduced in 5.8)
191202
MAP(swift::MacroExpansionExpr, void) // TODO (introduced in 5.8)
203+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
204+
MAP(swift::CopyExpr, void) // TODO (introduced in 5.9)
205+
MAP(swift::ConsumeExpr, void) // TODO (introduced in 5.9)
206+
MAP(swift::MaterializePackExpr, void) // TODO (introduced in 5.9)
207+
MAP(swift::SingleValueStmtExpr, void) // TODO (introduced in 5.9)
208+
#endif
209+
192210
MAP(swift::Decl, DeclTag)
193211
MAP(swift::ValueDecl, ValueDeclTag)
194212
MAP(swift::TypeDecl, TypeDeclTag)
@@ -231,6 +249,9 @@ MAP(swift::Decl, DeclTag)
231249
MAP(swift::PrefixOperatorDecl, PrefixOperatorDeclTag)
232250
MAP(swift::PostfixOperatorDecl, PostfixOperatorDeclTag)
233251
MAP(swift::MacroExpansionDecl, void) // TODO (introduced in 5.8)
252+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
253+
MAP(swift::MissingDecl, void) // TODO (introduced in 5.9)
254+
#endif
234255

235256
MAP(swift::Pattern, PatternTag)
236257
MAP(swift::ParenPattern, ParenPatternTag)
@@ -266,6 +287,10 @@ MAP(swift::TypeBase, TypeTag)
266287
MAP(swift::BuiltinUnsafeValueBufferType, BuiltinUnsafeValueBufferTypeTag)
267288
MAP(swift::BuiltinDefaultActorStorageType, BuiltinDefaultActorStorageTypeTag)
268289
MAP(swift::BuiltinVectorType, BuiltinVectorTypeTag)
290+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
291+
MAP(swift::BuiltinPackIndexType, void) // TODO: (introduced in 5.9)
292+
MAP(swift::BuiltinNonDefaultDistributedActorStorageType, void) // TODO: (introduced in 5.9)
293+
#endif
269294
MAP(swift::TupleType, TupleTypeTag)
270295
MAP(swift::ReferenceStorageType, ReferenceStorageTypeTag)
271296
MAP(swift::WeakStorageType, WeakStorageTypeTag)
@@ -307,13 +332,19 @@ MAP(swift::TypeBase, TypeTag)
307332
MAP(swift::SILBoxType, void) // SIL types cannot really appear in the frontend run)
308333
MAP(swift::SILMoveOnlyWrappedType, void) // SIL types cannot really appear in the frontend run)
309334
MAP(swift::SILTokenType, void) // SIL types cannot really appear in the frontend run)
335+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
336+
MAP(swift::SILPackType, void) // TODO: (introduced in 5.9)
337+
#endif
310338
MAP(swift::ProtocolCompositionType, ProtocolCompositionTypeTag)
311339
MAP(swift::ParameterizedProtocolType, ParameterizedProtocolTypeTag)
312340
MAP(swift::ExistentialType, ExistentialTypeTag)
313341
MAP(swift::LValueType, LValueTypeTag)
314342
MAP(swift::InOutType, InOutTypeTag)
315343
MAP(swift::PackType, void) // experimental variadic generics
316344
MAP(swift::PackExpansionType, void) // experimental variadic generics
345+
#if CODEQL_SWIFT_VERSION_GE(5, 9)
346+
MAP(swift::PackElementType, void) // TODO: (introduced in 5.9)
347+
#endif
317348
MAP(swift::TypeVariableType, void) // created during type checking and only used for constraint checking
318349
MAP(swift::SugarType, SugarTypeTag)
319350
MAP(swift::ParenType, ParenTypeTag)

swift/third_party/load.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
44
# TODO: remove `remove-result-of.patch` once we update to a Swift version containing
55
# https://github.com/apple/swift/commit/2ed2cea2
66
# (probably when updating to 5.9)
7-
_swift_prebuilt_version = "swift-5.8.1-RELEASE.212"
7+
_swift_prebuilt_version = "swift-5.8.1-RELEASE.214"
88
_swift_sha_map = {
9-
"Linux-X64": "3e902cc9dbf02129f6bcac84902524a235df0e36d30f3ac54e642b64d3f95a2b",
10-
"macOS-ARM64": "4d93f326bd8a41c89bcf593676407fab2dd84b665f6bfb7ab667a9673084bcda",
11-
"macOS-X64": "988cd193a0590abd282d8d8f3ec2489583d3d2b34162a4e91208fb91e5fb5981",
9+
"Linux-X64": "009594131d2f6327e0033c4b7b0479a5730427575eb59a81a439fe0e343aa777",
10+
"macOS-ARM64": "304a918e3699d404f57e967eff79b982388d8c5330c2135272c9f3a825920a39",
11+
"macOS-X64": "c763c493e5782869b54887dc72df2aad00d59af7272c6d96377f1debb98741f2",
1212
}
1313

1414
_swift_arch_map = {

0 commit comments

Comments
 (0)