Skip to content

Commit 13f1d2c

Browse files
committed
Make swiftinterfaces propagate #file behavior
Add -experimental-enable-concise-pound-file to the list of flags preserved by module interfaces, so that when we rebuild an interface, it comes out the same way as the original file.
1 parent d4fd2d7 commit 13f1d2c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def enable_experimental_additive_arithmetic_derivation :
516516

517517
def enable_experimental_concise_pound_file : Flag<["-"],
518518
"enable-experimental-concise-pound-file">,
519-
Flags<[FrontendOption]>,
519+
Flags<[FrontendOption, ModuleInterfaceOption]>,
520520
HelpText<"Enable experimental concise '#file' identifier">;
521521

522522
// Diagnostic control options

test/SILGen/magic_identifier_file.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
// Test in "Swift 6" mode:
1313
// RUN: %target-swift-emit-silgen -I %t -enable-experimental-concise-pound-file -module-name Foo %/s | %FileCheck --check-prefixes=BOTH,CONCISE %s
1414

15+
// Remove compiled modules so we test against interfaces:
16+
// RUN: rm %t/MagicIdentifierFileSwift5.swiftmodule %t/MagicIdentifierFileSwift6.swiftmodule
17+
18+
// Test in Swift 5 mode:
19+
// RUN: %target-swift-emit-silgen -I %t -module-name Foo %/s | %FileCheck --check-prefixes=BOTH,ABSOLUTE %s
20+
21+
// Test in "Swift 6" mode:
22+
// RUN: %target-swift-emit-silgen -I %t -enable-experimental-concise-pound-file -module-name Foo %/s | %FileCheck --check-prefixes=BOTH,CONCISE %s
23+
1524
import MagicIdentifierFileSwift5
1625
import MagicIdentifierFileSwift6
1726

0 commit comments

Comments
 (0)