Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Frontend/ModuleInterfaceLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2880,7 +2880,11 @@ static std::string getContextHash(const CompilerInvocation &CI,
//
// If OSSA modules are enabled, we use a separate namespace of modules to
// ensure that we compile all swift interface files with the option set.
unsigned(CI.getSILOptions().EnableOSSAModules));
unsigned(CI.getSILOptions().EnableOSSAModules),

// Is the C++ interop enabled?
unsigned(CI.getLangOptions().EnableCXXInterop)
);

return llvm::toString(llvm::APInt(64, H), 36, /*Signed=*/false);
}
Expand Down
35 changes: 35 additions & 0 deletions test/ModuleInterface/ModuleCache/cxx-interop-caching.swift
Original file line number Diff line number Diff line change
@@ -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}}