Skip to content

Commit 76649a1

Browse files
committed
[Serialization] Don't filter out unextended-module-map VFS in explicit builds.
In an explicit build LLDB needs to be able import the unmodified .pcms, so having the exact same flags matters there, and there is no risk of a recompilation failure, because nothing is recompiled. rdar://136759808
1 parent 88ac67d commit 76649a1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,14 +1167,19 @@ void Serializer::writeHeader() {
11671167
auto &Opts = Options.ExtraClangOptions;
11681168
for (auto Arg = Opts.begin(), E = Opts.end(); Arg != E; ++Arg) {
11691169
StringRef arg(*Arg);
1170-
if (arg.starts_with("-ivfsoverlay")) {
1170+
if (!Options.ExplicitModuleBuild && arg.starts_with("-ivfsoverlay")) {
11711171
// FIXME: This is a hack and calls for a better design.
11721172
//
11731173
// Filter out any -ivfsoverlay options that include an
11741174
// unextended-module-overlay.yaml overlay. By convention the Xcode
11751175
// buildsystem uses these while *building* mixed Objective-C and
11761176
// Swift frameworks; but they should never be used to *import* the
11771177
// module defined in the framework.
1178+
//
1179+
// This is not done for explicit modules builds. In an explicit
1180+
// build LLDB needs to be able import the unmodified .pcms, so
1181+
// having the exact same flags matters there, and there is no risk
1182+
// of a recompilation failure, because nothing is recompiled.
11781183
auto Next = std::next(Arg);
11791184
if (Next != E &&
11801185
StringRef(*Next).ends_with("unextended-module-overlay.yaml")) {

test/Serialization/search-paths-relative.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
// Output paths differ in the new driver, so force SWIFT_USE_OLD_DRIVER for now.
88
// RUN: cd %t/secret && env SWIFT_USE_OLD_DRIVER=1 %target-swiftc_driver -emit-module -o %t/has_xref.swiftmodule -I . -F ../Frameworks -parse-as-library %S/Inputs/has_xref.swift %S/../Inputs/empty.swift -Xfrontend -serialize-debugging-options -Xcc -ivfsoverlay -Xcc %S/../Inputs/unextended-module-overlay.yaml -Xcc -DDUMMY
9+
// RUN: cd %t/secret && env SWIFT_USE_OLD_DRIVER=1 %target-swiftc_driver -emit-module -o %t/explicit.swiftmodule -parse-stdlib -parse-as-library %S/../Inputs/empty.swift -Xfrontend -disable-implicit-swift-modules -Xfrontend -serialize-debugging-options -Xcc -ivfsoverlay -Xcc %S/../Inputs/unextended-module-overlay.yaml -Xcc -DDUMMY
910
// RUN: %target-swift-frontend %s -typecheck -I %t
1011

1112
// Ensure that in Swift 6 mode we do not read out search paths, thus are no longer able to
@@ -15,8 +16,10 @@
1516

1617
// Check the actual serialized search paths.
1718
// RUN: llvm-bcanalyzer -dump %t/has_xref.swiftmodule > %t/has_xref.swiftmodule.txt
19+
// RUN: llvm-bcanalyzer -dump %t/explicit.swiftmodule > %t/explicit.swiftmodule.txt
1820
// RUN: %FileCheck %s < %t/has_xref.swiftmodule.txt
1921
// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/has_xref.swiftmodule.txt
22+
// RUN: %FileCheck -check-prefix=EXPLICIT %s < %t/explicit.swiftmodule.txt
2023

2124
import has_xref
2225

@@ -36,6 +39,10 @@ numeric(42)
3639
// NEGATIVE-NOT: '.'
3740
// NEGATIVE-NOT: '../Frameworks'
3841
// This should be filtered out.
39-
// NEGATIVE-NOT: -ivfsoverlay{{.*}}unextended-module-overlay.yaml
42+
// NEGATIVE-NOT: -ivfsoverlay
43+
// NEGATIVE-NOT: unextended-module-overlay.yaml
44+
// EXPLICIT: -ivfsoverlay
45+
// EXPLICIT: unextended-module-overlay.yaml
46+
// EXPLICIT: -DDUMMY
4047

4148
// SWIFT6: error: missing required modules: 'has_alias', 'struct_with_operators'

0 commit comments

Comments
 (0)