File tree Expand file tree Collapse file tree 13 files changed +110
-0
lines changed Expand file tree Collapse file tree 13 files changed +110
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ endif()
103
103
104
104
set (compile_options
105
105
${c_include_paths_args}
106
+ "SHELL: -DRESILIENT_SWIFT_SYNTAX"
106
107
"SHELL: ${cxx_interop_flag} "
107
108
"SHELL: -Xcc -std=c++17 -Xcc -DCOMPILED_WITH_SWIFT -Xcc -DSWIFT_TARGET"
108
109
Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ extension ASTGenVisitor {
58
58
addAttribute ( self . generateDeclAttribute ( attribute: node) )
59
59
case . ifConfigDecl:
60
60
fatalError ( " unimplemented " )
61
+ #if RESILIENT_SWIFT_SYNTAX
62
+ @unknown default :
63
+ fatalError ( )
64
+ #endif
61
65
}
62
66
}
63
67
Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ extension ASTGenVisitor {
68
68
return self . generate ( typeAliasDecl: node) . asDecl
69
69
case . variableDecl( let node) :
70
70
return self . generate ( variableDecl: node) . asDecl
71
+ #if RESILIENT_SWIFT_SYNTAX
72
+ @unknown default :
73
+ fatalError ( )
74
+ #endif
71
75
}
72
76
return self . generateWithLegacy ( node)
73
77
}
@@ -421,6 +425,10 @@ extension ASTGenVisitor {
421
425
accessors: CollectionOfOne ( accessor) . bridgedArray ( in: self ) ,
422
426
rBraceLoc: rightBrace
423
427
)
428
+ #if RESILIENT_SWIFT_SYNTAX
429
+ @unknown default :
430
+ fatalError ( )
431
+ #endif
424
432
}
425
433
}
426
434
@@ -726,6 +734,10 @@ extension ASTGenVisitor {
726
734
} else {
727
735
body. associativity = associativity
728
736
}
737
+ #if RESILIENT_SWIFT_SYNTAX
738
+ @unknown default :
739
+ fatalError ( )
740
+ #endif
729
741
}
730
742
}
731
743
Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ fileprivate func emitDiagnosticParts(
73
73
replaceStartLoc = bridgedSourceLoc ( at: oldToken. endPositionBeforeTrailingTrivia)
74
74
replaceEndLoc = bridgedSourceLoc ( at: oldToken. endPosition)
75
75
newText = newTrivia. description
76
+
77
+ #if RESILIENT_SWIFT_SYNTAX
78
+ @unknown default :
79
+ fatalError ( )
80
+ #endif
76
81
}
77
82
78
83
newText. withBridgedString { bridgedMessage in
@@ -208,6 +213,11 @@ extension SourceManager {
208
213
at: oldToken. endPosition
209
214
)
210
215
newText = newTrivia. description
216
+
217
+ #if RESILIENT_SWIFT_SYNTAX
218
+ @unknown default :
219
+ fatalError ( )
220
+ #endif
211
221
}
212
222
213
223
newText. withBridgedString { bridgedMessage in
Original file line number Diff line number Diff line change @@ -197,6 +197,10 @@ extension ASTGenVisitor {
197
197
preconditionFailure ( " should be handled in generate(sequenceExpr:) " )
198
198
case . unresolvedTernaryExpr:
199
199
preconditionFailure ( " should be handled in generate(sequenceExpr:) " )
200
+ #if RESILIENT_SWIFT_SYNTAX
201
+ @unknown default :
202
+ fatalError ( )
203
+ #endif
200
204
}
201
205
preconditionFailure ( " isExprMigrated() mismatch " )
202
206
}
Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ extension ASTGenVisitor {
69
69
case . layoutRequirement( _) :
70
70
// FIXME: Implement layout requirement translation.
71
71
fatalError ( " Translation of layout requirements not implemented! " )
72
+ #if RESILIENT_SWIFT_SYNTAX
73
+ @unknown default :
74
+ fatalError ( )
75
+ #endif
72
76
}
73
77
}
74
78
Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ extension ASTGenVisitor {
88
88
colonLocs = elementNodes. lazy
89
89
. map ( { self . generateSourceLoc ( $0. colon) } )
90
90
. bridgedArray ( in: self )
91
+ #if RESILIENT_SWIFT_SYNTAX
92
+ @unknown default :
93
+ fatalError ( )
94
+ #endif
91
95
}
92
96
return . createParsed(
93
97
self . ctx,
Original file line number Diff line number Diff line change @@ -359,6 +359,10 @@ func checkMacroDefinition(
359
359
replacementsPtr. pointee = replacementBuffer. baseAddress
360
360
numReplacementsPtr. pointee = replacements. count
361
361
return Int ( BridgedMacroDefinitionKind . expandedMacro. rawValue)
362
+ #if RESILIENT_SWIFT_SYNTAX
363
+ @unknown default :
364
+ fatalError ( )
365
+ #endif
362
366
}
363
367
} catch let errDiags as DiagnosticsError {
364
368
let srcMgr = SourceManager ( cxxDiagnosticEngine: diagEnginePtr)
@@ -501,6 +505,9 @@ func expandFreestandingMacroIPC(
501
505
case . expression: pluginMacroRole = . expression
502
506
case . declaration: pluginMacroRole = . declaration
503
507
case . codeItem: pluginMacroRole = . codeItem
508
+ #if RESILIENT_SWIFT_SYNTAX
509
+ @unknown default : fatalError ( )
510
+ #endif
504
511
}
505
512
506
513
// Send the message.
@@ -790,6 +797,11 @@ func expandAttachedMacroIPC(
790
797
. declaration,
791
798
. codeItem:
792
799
preconditionFailure ( " unhandled macro role for attached macro " )
800
+
801
+ #if RESILIENT_SWIFT_SYNTAX
802
+ @unknown default :
803
+ fatalError ( )
804
+ #endif
793
805
}
794
806
795
807
// Prepare syntax nodes to transfer.
@@ -990,6 +1002,10 @@ fileprivate extension SyntaxProtocol {
990
1002
formatted = self . formatted ( )
991
1003
case . disabled:
992
1004
formatted = Syntax ( self )
1005
+ #if RESILIENT_SWIFT_SYNTAX
1006
+ @unknown default :
1007
+ fatalError ( )
1008
+ #endif
993
1009
}
994
1010
return formatted. trimmedDescription ( matching: { $0. isWhitespace } )
995
1011
}
Original file line number Diff line number Diff line change @@ -45,6 +45,10 @@ extension ASTGenVisitor {
45
45
return self . generate ( valueBindingPattern: node) . asPattern
46
46
case . wildcardPattern( let node) :
47
47
return self . generate ( wildcardPattern: node) . asPattern
48
+ #if RESILIENT_SWIFT_SYNTAX
49
+ @unknown default :
50
+ fatalError ( )
51
+ #endif
48
52
}
49
53
}
50
54
Original file line number Diff line number Diff line change @@ -131,6 +131,11 @@ extension SourceManager.MacroExpansionContext: MacroExpansionContext {
131
131
132
132
case . afterTrailingTrivia:
133
133
rawPosition = node. endPosition
134
+
135
+ #if RESILIENT_SWIFT_SYNTAX
136
+ @unknown default :
137
+ fatalError ( )
138
+ #endif
134
139
}
135
140
136
141
let offsetWithinSyntaxNode =
@@ -164,6 +169,11 @@ extension SourceManager.MacroExpansionContext: MacroExpansionContext {
164
169
165
170
case . filePath:
166
171
break
172
+
173
+ #if RESILIENT_SWIFT_SYNTAX
174
+ @unknown default :
175
+ fatalError ( )
176
+ #endif
167
177
}
168
178
169
179
// Do the location lookup.
You can’t perform that action at this time.
0 commit comments