Files
swift-mirror/test/Frontend/multi-threaded-wmo-opt-record-supplementary-map.swift
Ryan Mansfield 1f5fb751b5 Fix per-file supplementary outputs in multi-threaded WMO mode
In multi-threaded WMO builds, the frontend didn't properly handle per-file
supplementary outputs specified via output file maps or command-line
arguments.

This enables swift-driver to use -supplementary-output-file-map for
per-file outputs in multi-threaded WMO, instead of generating multiple
individual flags that the frontend rejects.
2025-12-05 07:30:02 -05:00

38 lines
1.6 KiB
Swift

// Test that frontend properly handles supplementary output file maps with
// optimization records in multi-threaded WMO mode
// RUN: %empty-directory(%t)
// RUN: echo 'public func funcA() -> Int { return 42 }' > %t/file_a.swift
// RUN: echo 'public func funcB() -> String { return "hello" }' > %t/file_b.swift
// RUN: echo '{' > %t/output-file-map.json
// RUN: echo ' "%/t/file_a.swift": {' >> %t/output-file-map.json
// RUN: echo ' "object": "%/t/file_a.o",' >> %t/output-file-map.json
// RUN: echo ' "yaml-opt-record": "%/t/file_a.opt.yaml",' >> %t/output-file-map.json
// RUN: echo ' "llvm-ir": "%/t/file_a.ll"' >> %t/output-file-map.json
// RUN: echo ' },' >> %t/output-file-map.json
// RUN: echo ' "%/t/file_b.swift": {' >> %t/output-file-map.json
// RUN: echo ' "object": "%/t/file_b.o",' >> %t/output-file-map.json
// RUN: echo ' "yaml-opt-record": "%/t/file_b.opt.yaml",' >> %t/output-file-map.json
// RUN: echo ' "llvm-ir": "%/t/file_b.ll"' >> %t/output-file-map.json
// RUN: echo ' }' >> %t/output-file-map.json
// RUN: echo '}' >> %t/output-file-map.json
// RUN: %target-swift-frontend -c %/t/file_a.swift %/t/file_b.swift \
// RUN: -wmo -num-threads 2 -O -module-name TestModule \
// RUN: -supplementary-output-file-map %t/output-file-map.json \
// RUN: -o %t/file_a.o -o %t/file_b.o
// RUN: ls %t/file_a.o
// RUN: ls %t/file_b.o
// RUN: ls %t/file_a.opt.yaml
// RUN: ls %t/file_b.opt.yaml
// RUN: ls %t/file_a.ll
// RUN: ls %t/file_b.ll
// RUN: grep -q "funcA" %t/file_a.opt.yaml
// RUN: grep -q "funcB" %t/file_b.opt.yaml
// RUN: grep -q "funcA" %t/file_a.ll
// RUN: grep -q "funcB" %t/file_b.ll