File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
test/ModuleInterface/ModuleCache Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -818,8 +818,11 @@ bool CompilerInstance::setUpModuleLoaders() {
818818 }
819819
820820 // Configure ModuleInterfaceChecker for the ASTContext.
821+ auto CacheFromInvocation = getInvocation ().getClangModuleCachePath ();
821822 auto const &Clang = clangImporter->getClangInstance ();
822- std::string ModuleCachePath = getModuleCachePathFromClang (Clang);
823+ std::string ModuleCachePath = CacheFromInvocation.empty ()
824+ ? getModuleCachePathFromClang (Clang)
825+ : CacheFromInvocation.str ();
823826 auto &FEOpts = Invocation.getFrontendOptions ();
824827 ModuleInterfaceLoaderOptions LoaderOpts (FEOpts);
825828 Context->addModuleInterfaceChecker (
Original file line number Diff line number Diff line change 1+ // UNSUPPORTED: OS=windows-msvc
2+ // RUN: %empty-directory(%t)
3+ // RUN: split-file %s %t
4+
5+ // RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -parse-stdlib -I %t -emit-module-interface-path %t/LeafModule.swiftinterface -module-name LeafModule %t/leaf.swift -emit-module -o /dev/null
6+ // RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -parse-stdlib -I %t -module-cache-path %t/swiftcache -emit-module-interface-path %t/OtherModule.swiftinterface -module-name OtherModule %t/other.swift -emit-module -o /dev/null
7+ // RUN: %target-swift-frontend -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -parse-stdlib -I %t -module-cache-path %t/swiftcache -Xcc -fmodules-cache-path=%t/clangcache -emit-module -o %t/TestModule.swiftmodule -module-name TestModule %t/main.swift
8+
9+ // RUN: NUM_SWIFT_MODULES=$(find %t/swiftcache -type f -name '*.swiftmodule' | wc -l)
10+ // RUN: NUM_CLANG_MODULES=$(find %t/clangcache -type f -name '*.pcm' | wc -l)
11+ /// Two swift modules, Leaf and Other
12+ // RUN: if [ ! $NUM_SWIFT_MODULES -eq 2 ]; then echo "Should only be 2 Swift Modules, found $NUM_SWIFT_MODULES"; exit 1; fi
13+ /// Two clang modules, shim and A
14+ // RUN: if [ ! $NUM_CLANG_MODULES -eq 2 ]; then echo "Should only be 2 Clang Modules, found $NUM_CLANG_MODULES"; exit 1; fi
15+
16+ //--- leaf.swift
17+ public func LeafFunc( ) { }
18+
19+ //--- other.swift
20+ import LeafModule
21+ public func OtherFunc( ) { }
22+
23+ //--- module.modulemap
24+ module A {
25+ header " A.h "
26+ export *
27+ }
28+
29+ //--- A.h
30+ void a( void) ;
31+
32+ //--- main.swift
33+ import OtherModule
34+ import A
35+
36+ public func TestFunc( ) {
37+ OtherFunc ( )
38+ a ( )
39+ }
You can’t perform that action at this time.
0 commit comments