Skip to content

Commit dde2ad1

Browse files
committed
Swift: do not print MacroRole as part of AST
1 parent 7129ffc commit dde2ad1

File tree

4 files changed

+1
-31
lines changed

4 files changed

+1
-31
lines changed

swift/ql/lib/codeql/swift/printast/PrintAstNode.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PrintAstConfiguration extends TPrintAstConfiguration {
2020
/**
2121
* Holds if the AST for `e` should be printed. By default, holds for all.
2222
*/
23-
predicate shouldPrint(Locatable e) { not e instanceof Diagnostics }
23+
predicate shouldPrint(Locatable e) { not e instanceof Diagnostics and not e instanceof MacroRole }
2424
}
2525

2626
private predicate shouldPrint(Locatable e) { any(PrintAstConfiguration config).shouldPrint(e) }

swift/ql/test/extractor-tests/generated/decl/CapturedDecl/PrintAst.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
#-----| [MacroRole] #freestanding(expression)
2-
#-----| [MacroRole] #freestanding(expression)
3-
#-----| [MacroRole] #freestanding(expression)
4-
#-----| [MacroRole] #freestanding(expression)
5-
#-----| [MacroRole] #freestanding(expression)
6-
#-----| [MacroRole] #freestanding(expression)
7-
#-----| [MacroRole] #freestanding(expression)
8-
#-----| [MacroRole] #freestanding(expression)
9-
#-----| [MacroRole] #freestanding(declaration)
10-
#-----| [MacroRole] #freestanding(declaration)
111
closures.swift:
122
# 1| [NamedFunction] hello()
133
# 1| InterfaceType = () -> String

swift/ql/test/extractor-tests/updates/PrintAst.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
#-----| [MacroRole] #freestanding(expression)
2-
#-----| [MacroRole] #freestanding(expression)
3-
#-----| [MacroRole] #freestanding(expression)
4-
#-----| [MacroRole] #freestanding(expression)
5-
#-----| [MacroRole] #freestanding(expression)
6-
#-----| [MacroRole] #freestanding(expression)
7-
#-----| [MacroRole] #freestanding(expression)
8-
#-----| [MacroRole] #freestanding(expression)
9-
#-----| [MacroRole] #freestanding(declaration)
10-
#-----| [MacroRole] #freestanding(declaration)
111
v5.8.swift:
122
# 1| [Comment] // https://github.com/apple/swift/blob/main/CHANGELOG.md#swift-58
133
# 1|

swift/ql/test/library-tests/ast/PrintAst.expected

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
#-----| [MacroRole] #freestanding(expression)
2-
#-----| [MacroRole] #freestanding(expression)
3-
#-----| [MacroRole] #freestanding(expression)
4-
#-----| [MacroRole] #freestanding(expression)
5-
#-----| [MacroRole] #freestanding(expression)
6-
#-----| [MacroRole] #freestanding(expression)
7-
#-----| [MacroRole] #freestanding(expression)
8-
#-----| [MacroRole] #freestanding(expression)
9-
#-----| [MacroRole] #freestanding(declaration)
10-
#-----| [MacroRole] #freestanding(declaration)
111
cfg.swift:
122
# 1| [TopLevelCodeDecl] { ... }
133
# 1| getBody(): [BraceStmt] { ... }

0 commit comments

Comments
 (0)