Preprocessor-like transformations in swift-syntax?

It looks like it's possible to perform preprocessor-like transformations on the syntax tree, given a list of compilation conditions and a target triple.

Is there any open-source project that implements this, or something I can look into?

You might to take a look at swift-syntax/Sources/SwiftIfConfig at main · swiftlang/swift-syntax · GitHub, which implements evaluation of Swift's #if conditions in the compiler.

1 Like

That looks exactly like what I need. Thank you!