Skip to content

Commit 6b95d2e

Browse files
Harlan Haskinsjrose-apple
authored andcommitted
[ParseableInterface] Keep track of -O flags in interface args
(cherry picked from commit 735267d)
1 parent a1ef331 commit 6b95d2e

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

include/swift/Option/Options.td

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ def module_cache_path : Separate<["-"], "module-cache-path">,
278278
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>,
279279
HelpText<"Specifies the Clang module cache path">;
280280

281-
def module_name : Separate<["-"], "module-name">, Flags<[FrontendOption, ParseableInterfaceOption]>,
281+
def module_name : Separate<["-"], "module-name">,
282+
Flags<[FrontendOption, ParseableInterfaceOption]>,
282283
HelpText<"Name of the module to build">;
283284
def module_name_EQ : Joined<["-"], "module-name=">, Flags<[FrontendOption]>,
284285
Alias<module_name>;
@@ -464,17 +465,20 @@ def Xlinker : Separate<["-"], "Xlinker">,
464465

465466
def O_Group : OptionGroup<"<optimization level options>">;
466467

467-
def Onone : Flag<["-"], "Onone">, Group<O_Group>, Flags<[FrontendOption]>,
468+
def Onone : Flag<["-"], "Onone">, Group<O_Group>,
469+
Flags<[FrontendOption, ParseableInterfaceOption]>,
468470
HelpText<"Compile without any optimization">;
469-
def O : Flag<["-"], "O">, Group<O_Group>, Flags<[FrontendOption]>,
471+
def O : Flag<["-"], "O">, Group<O_Group>,
472+
Flags<[FrontendOption, ParseableInterfaceOption]>,
470473
HelpText<"Compile with optimizations">;
471-
def Osize : Flag<["-"], "Osize">, Group<O_Group>, Flags<[FrontendOption]>,
474+
def Osize : Flag<["-"], "Osize">, Group<O_Group>,
475+
Flags<[FrontendOption, ParseableInterfaceOption]>,
472476
HelpText<"Compile with optimizations and target small code size">;
473477
def Ounchecked : Flag<["-"], "Ounchecked">, Group<O_Group>,
474-
Flags<[FrontendOption]>,
478+
Flags<[FrontendOption, ParseableInterfaceOption]>,
475479
HelpText<"Compile with optimizations and remove runtime safety checks">;
476480
def Oplayground : Flag<["-"], "Oplayground">, Group<O_Group>,
477-
Flags<[HelpHidden, FrontendOption]>,
481+
Flags<[HelpHidden, FrontendOption, ParseableInterfaceOption]>,
478482
HelpText<"Compile with optimizations appropriate for a playground">;
479483

480484
def RemoveRuntimeAsserts : Flag<["-"], "remove-runtime-asserts">,
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend -enable-resilience -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null
3+
// RUN: %target-swift-frontend -enable-resilience -emit-parseable-module-interface-path %t.swiftinterface -module-name t %s -emit-module -o /dev/null -Onone
44
// RUN: %FileCheck %s < %t.swiftinterface -check-prefix=CHECK-SWIFTINTERFACE
55
//
6-
// CHECK-SWIFTINTERFACE: {{swift-module-flags:.* -enable-resilience}}
6+
// CHECK-SWIFTINTERFACE: swift-module-flags:
7+
// CHECK-SWIFTINTERFACE-SAME: -enable-resilience
8+
// CHECK-SWIFTINTERFACE-SAME: -Onone
79

810
// Make sure flags show up when filelists are enabled
911

10-
// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation 2>&1
12+
// RUN: %target-build-swift %s -driver-filelist-threshold=0 -emit-parseable-module-interface -o %t/foo -module-name foo -module-link-name fooCore -force-single-frontend-invocation -Ounchecked 2>&1
1113
// RUN: %FileCheck %s < %t/foo.swiftinterface --check-prefix CHECK-FILELIST-INTERFACE
1214

1315
// CHECK-FILELIST-INTERFACE: swift-module-flags:
1416
// CHECK-FILELIST-INTERFACE-SAME: -target
1517
// CHECK-FILELIST-INTERFACE-SAME: -module-link-name fooCore
18+
// CHECK-FILELIST-INTERFACE-SAME: -Ounchecked
1619
// CHECK-FILELIST-INTERFACE-SAME: -module-name foo
1720

1821
public func foo() { }

0 commit comments

Comments
 (0)