mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialization: Consider the C++ interop use in module cache hash
It is expected to rebuild modules from swiftinterface when the C++ interop is enabled in clients. The swiftmodule produced is different. Make sure the rebuilt module is kept under a distinct cache key to avoid reusing previously compiled modules in an incompatible mode.
This commit is contained in:
35
test/ModuleInterface/ModuleCache/cxx-interop-caching.swift
Normal file
35
test/ModuleInterface/ModuleCache/cxx-interop-caching.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: split-file %s %t --leading-lines
|
||||
|
||||
/// Build one library module
|
||||
// RUN: %target-swift-frontend -parse-stdlib -emit-module \
|
||||
// RUN: -o %t/Lib.swiftmodule %t/Lib.swift \
|
||||
// RUN: -emit-module-interface-path %t/Lib.swiftinterface \
|
||||
// RUN: -swift-version 5 -enable-library-evolution -module-name Lib
|
||||
|
||||
/// Distributed scenario with only the swiftinterface
|
||||
// RUN: rm %t/Lib.swiftmodule
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
|
||||
/// Rebuild from the swiftinterface just once for non-C++ users
|
||||
// RUN: %target-swift-frontend -parse-stdlib -typecheck %t/Rebuild.swift -I %t \
|
||||
// RUN: -module-cache-path %t/ModuleCache -Rmodule-interface-rebuild -verify
|
||||
// RUN: %target-swift-frontend -parse-stdlib -typecheck %t/UseExisting.swift -I %t \
|
||||
// RUN: -module-cache-path %t/ModuleCache -Rmodule-interface-rebuild -verify
|
||||
|
||||
/// Rebuild from the swiftinterface just once for C++ users
|
||||
// RUN: %target-swift-frontend -parse-stdlib -typecheck %t/Rebuild.swift -I %t \
|
||||
// RUN: -module-cache-path %t/ModuleCache -Rmodule-interface-rebuild -verify \
|
||||
// RUN: -cxx-interoperability-mode=default
|
||||
// RUN: %target-swift-frontend -parse-stdlib -typecheck %t/UseExisting.swift -I %t \
|
||||
// RUN: -module-cache-path %t/ModuleCache -Rmodule-interface-rebuild -verify \
|
||||
// RUN: -cxx-interoperability-mode=default
|
||||
|
||||
//--- Lib.swift
|
||||
public func publicFunction() {}
|
||||
|
||||
//--- UseExisting.swift
|
||||
import Lib
|
||||
|
||||
//--- Rebuild.swift
|
||||
import Lib // expected-remark {{rebuilding module 'Lib' from interface}}
|
||||
Reference in New Issue
Block a user