Skip to content

Commit 423c853

Browse files
committed
Swift: skip MacroExpansionExpr/MacroExpansionDecl
They only appear in an intermediate AST and disappear as soon as the macro is expanded. The only way to get these in is to construct an "incorrect" AST, e.g.: ``` let x = #does_not_exist() // MacroExpansionExpr struct S { #does_not_exist() // MacroExpansionDecl } ```
1 parent 8b126fe commit 423c853

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

swift/extractor/infra/SwiftTagTraits.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ MAP(swift::Expr, ExprTag)
196196
MAP(swift::OneWayExpr, OneWayExprTag)
197197
MAP(swift::TapExpr, TapExprTag)
198198
MAP(swift::TypeJoinExpr, void) // TODO (introduced in 5.8)
199-
MAP(swift::MacroExpansionExpr, void) // TODO (introduced in 5.8)
199+
MAP(swift::MacroExpansionExpr, void) // unexpanded macro in an expr context, skipping
200200
MAP(swift::CopyExpr, CopyExprTag)
201201
MAP(swift::ConsumeExpr, ConsumeExprTag)
202202
MAP(swift::MaterializePackExpr, void) // TODO (introduced in 5.9)
@@ -243,10 +243,8 @@ MAP(swift::Decl, DeclTag)
243243
MAP(swift::InfixOperatorDecl, InfixOperatorDeclTag)
244244
MAP(swift::PrefixOperatorDecl, PrefixOperatorDeclTag)
245245
MAP(swift::PostfixOperatorDecl, PostfixOperatorDeclTag)
246-
MAP(swift::MacroExpansionDecl, void) // TODO (introduced in 5.8)
247-
#if CODEQL_SWIFT_VERSION_GE(5, 9)
248-
MAP(swift::MissingDecl, void) // TODO (introduced in 5.9)
249-
#endif
246+
MAP(swift::MacroExpansionDecl, void) // unexpanded macro in a decl context, skipping
247+
MAP(swift::MissingDecl, void) // appears around an unexpanded macro, skipping
250248

251249
MAP(swift::Pattern, PatternTag)
252250
MAP(swift::ParenPattern, ParenPatternTag)

0 commit comments

Comments
 (0)