mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This commit adds -sil-output-path and -ir-output-path frontend options that allow generating SIL and LLVM IR files as supplementary outputs during normal compilation. These options can be useful for debugging and analysis tools workflows that need access to intermediate compilation artifacts without requiring separate compiler invocations. Expected behaviour: Primary File mode: - SIL: Generates one .sil file per source file - IR: Generates one .ll file per source file Single-threaded WMO mode: - SIL: Generates one .sil file for the entire module - IR: Generates one .ll file for the entire module Multi-threaded WMO mode: - SIL: Generates one .sil file for the entire module - IR: Generates separate .ll files per source file File Maps with WMO: - Both SIL and IR outputs using first entry's naming, which is consistent with the behaviour of other supplementary outputs. rdar://160297898
13 lines
422 B
Swift
13 lines
422 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend -emit-object -sil-output-path %t/test.sil %s -o %t/test.o
|
|
// RUN: %FileCheck -input-file %t/test.sil %s --check-prefix=SIL-CHECK
|
|
// RUN: test -f %t/test.o
|
|
|
|
// Test that -sil-output-path produces SIL output alongside normal compilation
|
|
|
|
func testFunction() -> Int {
|
|
return 42
|
|
}
|
|
|
|
// SIL-CHECK: sil hidden @$s4test0A8FunctionSiyF : $@convention(thin) () -> Int
|