Skip to content

Commit

Permalink
add swift_module_skip_function_bodies
Browse files Browse the repository at this point in the history
Summary: Add an attribute to control passing the `-experimental-skip-non-inlinable-function-bodies-without-types` flag. This is required to work around compiler bugs present when passing the flag for some modules.

Reviewed By: milend

Differential Revision: D62189216

fbshipit-source-id: f4038cb89510205b7dd9217c56a5372076c15053
  • Loading branch information
rmaz authored and facebook-github-bot committed Sep 4, 2024
1 parent dd83d24 commit 5fa46bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions prelude/apple/swift/swift_compilation.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,14 @@ def _compile_swiftmodule(
argfile_cmd = cmd_args(shared_flags)
argfile_cmd.add([
"-emit-module",
"-Xfrontend",
"-experimental-skip-non-inlinable-function-bodies-without-types",
])

if ctx.attrs.swift_module_skip_function_bodies:
argfile_cmd.add([
"-Xfrontend",
"-experimental-skip-non-inlinable-function-bodies-without-types",
])

if _should_compile_with_evolution(ctx):
argfile_cmd.add(["-enable-library-evolution"])
argfile_cmd.add(["-emit-module-interface"])
Expand Down
3 changes: 3 additions & 0 deletions prelude/decls/ios_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ apple_binary = prelude_rule(
"supported_platforms_regex": attrs.option(attrs.regex(), default = None),
"supports_merged_linking": attrs.option(attrs.bool(), default = None),
"swift_compiler_flags": attrs.list(attrs.arg(), default = []),
"swift_module_skip_function_bodies": attrs.bool(default = True),
"swift_version": attrs.option(attrs.string(), default = None),
"thin_lto": attrs.bool(default = False),
"use_submodules": attrs.bool(default = False),
Expand Down Expand Up @@ -512,6 +513,7 @@ apple_library = prelude_rule(
"supported_platforms_regex": attrs.option(attrs.regex(), default = None),
"supports_merged_linking": attrs.option(attrs.bool(), default = None),
"swift_compiler_flags": attrs.list(attrs.arg(), default = []),
"swift_module_skip_function_bodies": attrs.bool(default = True),
"swift_version": attrs.option(attrs.string(), default = None),
"thin_lto": attrs.bool(default = False),
"use_submodules": attrs.bool(default = False),
Expand Down Expand Up @@ -774,6 +776,7 @@ apple_test = prelude_rule(
"supported_platforms_regex": attrs.option(attrs.regex(), default = None),
"supports_merged_linking": attrs.option(attrs.bool(), default = None),
"swift_compiler_flags": attrs.list(attrs.arg(), default = []),
"swift_module_skip_function_bodies": attrs.bool(default = True),
"swift_version": attrs.option(attrs.string(), default = None),
"test_rule_timeout_ms": attrs.option(attrs.int(), default = None),
"thin_lto": attrs.bool(default = False),
Expand Down

0 comments on commit 5fa46bb

Please sign in to comment.