Skip to content

Commit 327ea8b

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 25ff82f commit 327ea8b

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
@@ -293,6 +293,9 @@ if(SWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING)
293293
list(APPEND swift_stdlib_compile_flags "-enforce-exclusivity=checked")
294294
endif()
295295

296+
# STAGING: Temporarily avoids having to write #fileID in Swift.swiftinterface.
297+
list(APPEND swift_stdlib_compile_flags "-Xfrontend" "-enable-experimental-concise-pound-file")
298+
296299
if(SWIFT_CHECK_ESSENTIAL_STDLIB)
297300
add_swift_target_library(swift_stdlib_essential ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
298301
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)