12
12
#include < swift/AST/Pattern.h>
13
13
#include < swift/AST/TypeRepr.h>
14
14
#include < swift/AST/Type.h>
15
+ #include < swift/CodeQLSwiftVersion.h>
15
16
16
17
namespace codeql {
17
18
@@ -26,6 +27,9 @@ namespace codeql {
26
27
using type = TAG; \
27
28
};
28
29
30
+ #define CODEQL_SWIFT_VERSION_GE (MAJOR, MINOR ) \
31
+ CODEQL_SWIFT_VERSION_MAJOR >= (MAJOR) && CODEQL_SWIFT_VERSION_MINOR >= (MINOR)
32
+
29
33
// clang-format off
30
34
// use indentation to recreate all involved type hierarchies
31
35
MAP (std::filesystem::path, DbFileTag)
@@ -56,6 +60,9 @@ MAP(swift::Stmt, StmtTag)
56
60
MAP (swift::FailStmt, FailStmtTag)
57
61
MAP (swift::ThrowStmt, ThrowStmtTag)
58
62
MAP (swift::PoundAssertStmt, PoundAssertStmtTag)
63
+ #if CODEQL_SWIFT_VERSION_GE(5, 9)
64
+ MAP (swift::DiscardStmt, void ) // TODO (introduced in 5.9)
65
+ #endif
59
66
60
67
MAP (swift::Argument, ArgumentTag)
61
68
MAP (swift::KeyPathExpr::Component, KeyPathComponentTag)
@@ -95,7 +102,11 @@ MAP(swift::Expr, ExprTag)
95
102
MAP (swift::IdentityExpr, IdentityExprTag)
96
103
MAP (swift::ParenExpr, ParenExprTag)
97
104
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
99
110
MAP (swift::AwaitExpr, AwaitExprTag)
100
111
MAP (swift::UnresolvedMemberChainResultExpr, UnresolvedMemberChainResultExprTag)
101
112
MAP (swift::AnyTryExpr, AnyTryExprTag)
@@ -189,6 +200,13 @@ MAP(swift::Expr, ExprTag)
189
200
MAP (swift::TapExpr, TapExprTag)
190
201
MAP (swift::TypeJoinExpr, void ) // TODO (introduced in 5.8)
191
202
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
+
192
210
MAP (swift::Decl, DeclTag)
193
211
MAP (swift::ValueDecl, ValueDeclTag)
194
212
MAP (swift::TypeDecl, TypeDeclTag)
@@ -231,6 +249,9 @@ MAP(swift::Decl, DeclTag)
231
249
MAP (swift::PrefixOperatorDecl, PrefixOperatorDeclTag)
232
250
MAP (swift::PostfixOperatorDecl, PostfixOperatorDeclTag)
233
251
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
234
255
235
256
MAP (swift::Pattern, PatternTag)
236
257
MAP (swift::ParenPattern, ParenPatternTag)
@@ -266,6 +287,10 @@ MAP(swift::TypeBase, TypeTag)
266
287
MAP (swift::BuiltinUnsafeValueBufferType, BuiltinUnsafeValueBufferTypeTag)
267
288
MAP (swift::BuiltinDefaultActorStorageType, BuiltinDefaultActorStorageTypeTag)
268
289
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
269
294
MAP (swift::TupleType, TupleTypeTag)
270
295
MAP (swift::ReferenceStorageType, ReferenceStorageTypeTag)
271
296
MAP (swift::WeakStorageType, WeakStorageTypeTag)
@@ -307,13 +332,19 @@ MAP(swift::TypeBase, TypeTag)
307
332
MAP (swift::SILBoxType, void ) // SIL types cannot really appear in the frontend run)
308
333
MAP (swift::SILMoveOnlyWrappedType, void ) // SIL types cannot really appear in the frontend run)
309
334
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
310
338
MAP (swift::ProtocolCompositionType, ProtocolCompositionTypeTag)
311
339
MAP (swift::ParameterizedProtocolType, ParameterizedProtocolTypeTag)
312
340
MAP (swift::ExistentialType, ExistentialTypeTag)
313
341
MAP (swift::LValueType, LValueTypeTag)
314
342
MAP (swift::InOutType, InOutTypeTag)
315
343
MAP (swift::PackType, void ) // experimental variadic generics
316
344
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
317
348
MAP (swift::TypeVariableType, void ) // created during type checking and only used for constraint checking
318
349
MAP (swift::SugarType, SugarTypeTag)
319
350
MAP (swift::ParenType, ParenTypeTag)
0 commit comments