mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We've recently added the -experimental-hermetic-seal-at-link compiler flag, which turns on aggressive dead-stripping optimizations and assumes that library code can be optimized against client code because all users of the library code/types are present at link/LTO time. This means that any module that's built with -experimental-hermetic-seal-at-link requires all clients of this module to also use -experimental-hermetic-seal-at-link. This PR enforces that by storing a bit in the serialized module, and checking the bit when importing modules.
16 lines
681 B
Swift
16 lines
681 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-swift-frontend %s -D MOD1 -experimental-hermetic-seal-at-link -emit-module -o %t/Mod1.swiftmodule
|
|
// RUN: not %target-swift-frontend %s -D MOD2 -emit-module -o %t/Mod2.swiftmodule -I %t 2>&1 | %FileCheck %s
|
|
// RUN: %target-swift-frontend %s -D MOD2 -experimental-hermetic-seal-at-link -emit-module -o %t/Mod2.swiftmodule -I %t
|
|
|
|
// CHECK: {{.*}} error: module 'Mod1' was built with -experimental-hermetic-seal-at-link, but current compilation does not have -experimental-hermetic-seal-at-link
|
|
|
|
#if MOD1
|
|
public func foo() {}
|
|
#endif
|
|
|
|
#if MOD2
|
|
import Mod1
|
|
public func bar() {}
|
|
#endif
|