mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add Swift compilation flags to enable Clang's validate-per-build-session module behavior
Add '-validate-clang-modules-once' and '-clang-build-session-file' corresponding to Clang's '-fmodules-validate-once-per-build-session' and '-fbuild-session-file='. Ensure they are propagated to module interface build sub-invocations. We require these to be first-class Swift options in order to ensure they are propagated to both: ClangImporter and implicit interface build compiler sub-invocations. Compiler portion of rdar://105982120
This commit is contained in:
41
test/ModuleInterface/clang-session-transitive.swift
Normal file
41
test/ModuleInterface/clang-session-transitive.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
// This test ensures that the parent invocation's '-validate-clang-modules-once' flag is inherited when building dependency modules
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: touch %t/Build.session
|
||||
|
||||
// RUN: %target-build-swift -module-name TestModule -module-link-name TestModule %S/Inputs/TestModule.swift -enable-library-evolution -emit-module-interface -o %t/TestModule.swiftmodule -swift-version 5 -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import
|
||||
|
||||
// RUN: %target-swift-frontend -scan-dependencies %s -o %t/deps.json -I%t -validate-clang-modules-once -clang-build-session-file %t/Build.session -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import
|
||||
// RUN: %FileCheck %s < %t/deps.json
|
||||
|
||||
import TestModule
|
||||
|
||||
// CHECK: "directDependencies": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-DAG: "swift": "TestModule"
|
||||
// CHECK-DAG: "swift": "Swift"
|
||||
// CHECK-DAG: "swift": "SwiftOnoneSupport"
|
||||
|
||||
// CHECK: "swift": "TestModule"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "modulePath": "{{.*}}TestModule-{{.*}}.swiftmodule",
|
||||
// CHECK-NEXT: "sourceFiles": [
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "directDependencies": [
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "swift": "Swift"
|
||||
// CHECK-NEXT: },
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: "swift": "SwiftOnoneSupport"
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: ],
|
||||
// CHECK-NEXT: "details": {
|
||||
// CHECK-NEXT: "swift": {
|
||||
// CHECK-NEXT: "moduleInterfacePath":
|
||||
// CHECK-NEXT: "contextHash":
|
||||
// CHECK-NEXT: "commandLine": [
|
||||
// CHECK-NEXT: "-frontend",
|
||||
// CHECK-NEXT: "-compile-module-from-interface",
|
||||
// CHECK: "-validate-clang-modules-once",
|
||||
// CHECK-NEXT: "-clang-build-session-file",
|
||||
// CHECK-NEXT: "{{.*}}Build.session"
|
||||
Reference in New Issue
Block a user