When compiling multiple Swift files (because they have inter-relationships between them, for example) it's not possible to get the assembly written out to a file. The only output possibility is to stdout.
This command will print out the assembly of the file to stdout:
swiftc -module-name example -emit-assembly main.swift dependency.swift
However, if you try and get it to write to separate files, it doesn't because multiple -o files are not permitted:
swiftc -module-name example -emit-assembly main.swift -o main.s dependency.swift -o dependency.s
error: cannot specify -o when generating multiple output files
Normally with clang this would be taken care of simply by passing -S (which is also the same for the swift compiler) and the output would be written to <filename>.s for each individual file. However, for -S in swiftc, it assumes that you want to write to stdout:
What I'd like to do is be able to generate individual files, or be allowed to have a means of disabling the automatic-stdout option for the -emit phases (probably the same for ll as well). This would require either an additional option that disables this option, or have a means to allow a per-file output when multiple source files are used.