Skip to content

Commit a71fe1c

Browse files
committed
[Staging] Force stdlib into “Swift 6 mode” for #file
We ultimately want to explicitly change standard library uses of #file to #fileID, but once we do, previous compilers won’t be able to build the standard library. So instead, we will temporarily build the standard library with -enable-experimental-concise-pound-file, which should have the same effect, but will back-deploy to compilers going back several months.
1 parent a4d1527 commit a71fe1c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ if(SWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING)
288288
list(APPEND swift_stdlib_compile_flags "-enforce-exclusivity=checked")
289289
endif()
290290

291+
# STAGING: Temporarily avoids having to write #fileID in Swift.swiftinterface.
292+
list(APPEND swift_stdlib_compile_flags "-Xfrontend" "-enable-experimental-concise-pound-file")
293+
291294
if(SWIFT_CHECK_ESSENTIAL_STDLIB)
292295
add_swift_target_library(swift_stdlib_essential ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
293296
INSTALL_IN_COMPONENT never_install

test/SILGen/magic_identifier_file.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func swift6LibraryUse() {
5353
func stdlibUse() {
5454
// BOTH-LABEL: sil {{.*}} @$s3Foo9stdlibUseyyF
5555
fatalError()
56-
// BOTH: string_literal utf8 "SOURCE_DIR/test/SILGen/magic_identifier_file.swift"
56+
// BOTH: string_literal utf8 "Foo/magic_identifier_file.swift"
5757
}
5858

5959
func forceUnwrap(_ x: ()?) {

0 commit comments

Comments
 (0)