Files
swift-mirror/test/Serialization/hermetic-seal-import.swift
Kuba (Brecka) Mracek c89eca6c34 Enforce consistent usage of -experimental-hermetic-seat-at-link flag (#39986)
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.
2021-11-30 10:44:58 -08:00

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