mirror of
https://github.com/apple/swift.git
synced 2026-10-18 17:49:23 +02:00
When reading a swiftmodule file, the module name was derived from the file name. That's wrong for modules in a `<module-name>.swiftmodule` directory, where the file is named after the target, e.g. `arm64-apple-macos.swiftmodule`. It caused an assertion because the resulting module name is not an identifier. Instead, prefer the module name which is recorded in the module file itself and only fall back to the file name if it's not available.
12 lines
821 B
Plaintext
12 lines
821 B
Plaintext
// Make sure that we can deserialize the stdlib.
|
|
// RUN: %target-sil-opt %platform-module-dir/Swift.swiftmodule/%target-swiftmodule-name -module-name Swift > /dev/null || %target-sil-opt %platform-module-dir/Swift.swiftmodule -module-name Swift > /dev/null
|
|
// RUN: %llvm-bcanalyzer %platform-module-dir/Swift.swiftmodule/%target-swiftmodule-name > %t || %llvm-bcanalyzer %platform-module-dir/Swift.swiftmodule > %t
|
|
// RUN: %FileCheck %s < %t
|
|
|
|
// Without -module-name, the module name must be taken from the module file and
|
|
// not from the file name, which is the target triple for modules in a
|
|
// `Swift.swiftmodule` directory.
|
|
// RUN: %target-sil-opt %platform-module-dir/Swift.swiftmodule/%target-swiftmodule-name > /dev/null || %target-sil-opt %platform-module-dir/Swift.swiftmodule > /dev/null
|
|
|
|
// CHECK-NOT: Unknown
|