mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
In the refactoring change #76700, it accidentally introduced a behavior change that causes the generated PCM command-line to have useful VFSOverlay files getting dropped. Clang module command-line and its unused VFS pruning should be done by the clang dependency scanner already so there is no need to touch that in the swift scanner. Since the original logics is not used to handle clang module commands, it will actually dropped the useful vfs overlay that is needed when none of the dependencies uses it. Fix the regression by restoring the old behavior and ignoring clang modules when pruning VFS overlay. rdar://139233781
75 lines
2.3 KiB
Swift
75 lines
2.3 KiB
Swift
// REQUIRES: objc_interop
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: %empty-directory(%t/module-cache)
|
|
// RUN: %empty-directory(%t/redirects)
|
|
// RUN: split-file %s %t
|
|
|
|
// RUN: sed -e "s|OUT_DIR|%t/redirects|g" -e "s|IN_DIR|%S/Inputs/CHeaders|g" %t/overlay_template.yaml > %t/overlay.yaml
|
|
|
|
// RUN: %target-swift-frontend -scan-dependencies -module-load-mode prefer-interface -module-cache-path %t/module-cache %t/test.swift -o %t/deps.json -I %S/Inputs/CHeaders -I %S/Inputs/Swift -disable-implicit-concurrency-module-import -disable-implicit-string-processing-module-import -Xcc -ivfsoverlay -Xcc %t/overlay.yaml
|
|
// RUN: %validate-json %t/deps.json | %FileCheck %s
|
|
|
|
//--- redirects/RedirectedF.h
|
|
void funcRedirectedF(void);
|
|
|
|
//--- overlay_template.yaml
|
|
{
|
|
'version': 0,
|
|
'use-external-names': false,
|
|
'roots': [
|
|
{
|
|
'name': 'IN_DIR', 'type': 'directory',
|
|
'contents': [
|
|
{ 'name': 'F.h', 'type': 'file',
|
|
'external-contents': 'OUT_DIR/RedirectedF.h'
|
|
}
|
|
]
|
|
},
|
|
]
|
|
}
|
|
|
|
//--- test.swift
|
|
import F
|
|
|
|
// CHECK: "mainModuleName": "deps"
|
|
/// --------Main module
|
|
// CHECK-LABEL: "modulePath": "deps.swiftmodule",
|
|
// CHECK-NEXT: sourceFiles
|
|
// CHECK-NEXT: test.swift
|
|
// CHECK-NEXT: ],
|
|
// CHECK-NEXT: "directDependencies": [
|
|
// CHECK-DAG: "swift": "F"
|
|
// CHECK-DAG: "swift": "Swift"
|
|
// CHECK-DAG: "swift": "SwiftOnoneSupport"
|
|
// CHECK: ],
|
|
|
|
// Ensure that the VFS overlay command-line flag is preserved on the Swift module dependency
|
|
// that uses a Clang module affected by this overlay
|
|
/// --------Swift module F
|
|
// CHECK-LABEL: "modulePath": "{{.*}}{{/|\\}}F-{{.*}}.swiftmodule",
|
|
|
|
// CHECK: "directDependencies": [
|
|
// CHECK-NEXT: {
|
|
// CHECK-DAG: "clang": "F"
|
|
// CHECK-DAG: "swift": "Swift"
|
|
// CHECK-DAG: "swift": "SwiftOnoneSupport"
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ],
|
|
|
|
// CHECK: "commandLine": [
|
|
// CHECK: "-compile-module-from-interface"
|
|
// CHECK: "-ivfsoverlay",
|
|
// CHECK-NEXT: "-Xcc",
|
|
// CHECK-NEXT: "{{.*}}{{/|\\}}preserve_used_vfs.swift.tmp{{/|\\}}overlay.yaml",
|
|
// CHECK: ],
|
|
|
|
/// --------Clang module F
|
|
// CHECK-LABEL: "modulePath": "{{.*}}{{/|\\}}F-{{.*}}.pcm",
|
|
// CHECK: "commandLine": [
|
|
// CHECK: "-vfsoverlay",
|
|
// CHECK-NEXT: "{{.*}}{{/|\\}}preserve_used_vfs.swift.tmp{{/|\\}}overlay.yaml",
|
|
// CHECK: "-ivfsoverlay",
|
|
// CHECK-NEXT: "-Xcc",
|
|
// CHECK-NEXT: "{{.*}}{{/|\\}}preserve_used_vfs.swift.tmp{{/|\\}}overlay.yaml",
|
|
// CHECK: ],
|