How to emit SIL for modules built in a package?

Is it possible to emit SIL (and/or LLVM IR) for all the modules built in a package?

I don't know if there's a more principled way to do it, but you could try hacking something together by running swift build --verbose, and doing some text replacement on the Swift compiler invocations printed by it (-c -> -emit-sil, -o /path/to/file.o -> -o /path/to/file.sil).

3 Likes