Skip to content

Commit f80ffa1

Browse files
[ScanDependency] Fix a regression caused by rewrite in swiftlang#76700
In the refactoring change swiftlang#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 (cherry picked from commit e5d0c207f19cb7be40019a74b8e5b02075410689)
1 parent 22544f3 commit f80ffa1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/DependencyScan/ScanDependencies.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,11 @@ class ExplicitModuleDependencyResolver {
451451
}
452452

453453
void pruneUnusedVFSOverlay() {
454+
// Pruning of unused VFS overlay options for Clang dependencies is performed
455+
// by the Clang dependency scanner.
456+
if (moduleID.Kind == ModuleDependencyKind::Clang)
457+
return;
458+
454459
std::vector<std::string> resolvedCommandLine;
455460
size_t skip = 0;
456461
for (auto it = commandline.begin(), end = commandline.end();

test/ScanDependencies/preserve_used_vfs.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,10 @@ import F
6565

6666
/// --------Clang module F
6767
// CHECK-LABEL: "modulePath": "{{.*}}{{/|\\}}F-{{.*}}.pcm",
68+
// CHECK: "commandLine": [
69+
// CHECK: "-vfsoverlay",
70+
// CHECK-NEXT: "{{.*}}{{/|\\}}preserve_used_vfs.swift.tmp{{/|\\}}overlay.yaml",
71+
// CHECK: "-ivfsoverlay",
72+
// CHECK-NEXT: "-Xcc",
73+
// CHECK-NEXT: "{{.*}}{{/|\\}}preserve_used_vfs.swift.tmp{{/|\\}}overlay.yaml",
74+
// CHECK: ],

0 commit comments

Comments
 (0)