mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When executable plugins crashed or somehow decided to exit, the compiler should relaunch the plugin executable before sending another message.
18 lines
462 B
Swift
18 lines
462 B
Swift
import SwiftDiagnostics
|
|
import SwiftOperators
|
|
import SwiftSyntax
|
|
import SwiftSyntaxBuilder
|
|
import SwiftSyntaxMacros
|
|
|
|
|
|
public struct CrashingMacro: ExpressionMacro {
|
|
public static func expansion(
|
|
of macro: some FreestandingMacroExpansionSyntax,
|
|
in context: some MacroExpansionContext
|
|
) -> ExprSyntax {
|
|
let arg: UInt = UInt(macro.argumentList.first!.expression.description)!
|
|
let zero: UInt = 0
|
|
return "\(raw: zero - arg).description"
|
|
}
|
|
}
|