mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When setting up the ModuleInterfaceChecker, prefer using the module cache path from command-line invocation `-module-cache-path` before falling back to clang options. Usually those two yield the same result, except for LLDB under direct cc1 argument mode and explicit module build. Under such mode, the cc1 option for module cache path will be stripped since the output PCMs are explicit passed as output. When LLDB attempted to do an implicit module compilation for the swift interface, it will not be able to locate the module cache path from cc1 arguments. On the other hand, the module cache option has already be inherited by the sub-instance so it can just directly be located there. rdar://137610484
40 lines
1.7 KiB
Swift
40 lines
1.7 KiB
Swift
// UNSUPPORTED: OS=windows-msvc
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: split-file %s %t
|
|
|
|
// 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
|
|
// 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
|
|
// 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
|
|
|
|
// RUN: NUM_SWIFT_MODULES=$(find %t/swiftcache -type f -name '*.swiftmodule' | wc -l)
|
|
// RUN: NUM_CLANG_MODULES=$(find %t/clangcache -type f -name '*.pcm' | wc -l)
|
|
/// Two swift modules, Leaf and Other
|
|
// RUN: if [ ! $NUM_SWIFT_MODULES -eq 2 ]; then echo "Should only be 2 Swift Modules, found $NUM_SWIFT_MODULES"; exit 1; fi
|
|
/// Two clang modules, shim and A
|
|
// RUN: if [ ! $NUM_CLANG_MODULES -eq 2 ]; then echo "Should only be 2 Clang Modules, found $NUM_CLANG_MODULES"; exit 1; fi
|
|
|
|
//--- leaf.swift
|
|
public func LeafFunc() {}
|
|
|
|
//--- other.swift
|
|
import LeafModule
|
|
public func OtherFunc() {}
|
|
|
|
//--- module.modulemap
|
|
module A {
|
|
header "A.h"
|
|
export *
|
|
}
|
|
|
|
//--- A.h
|
|
void a(void);
|
|
|
|
//--- main.swift
|
|
import OtherModule
|
|
import A
|
|
|
|
public func TestFunc() {
|
|
OtherFunc()
|
|
a()
|
|
}
|