Skip to content

Commit

Permalink
Add a feature that enables -index-include-locals for Swift compiles.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 574234005
  • Loading branch information
allevato authored and swiple-rules-gardener committed Oct 17, 2023
1 parent 6cae838 commit c9b81c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions swift/internal/feature_names.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ SWIFT_FEATURE_INDEX_SYSTEM_MODULES = "swift.index_system_modules"
# store among its outputs.
SWIFT_FEATURE_INDEX_WHILE_BUILDING = "swift.index_while_building"

# If enabled, indexstore data will contain local definitions and references.
#
# NOTE: This is only applicable if `SWIFT_FEATURE_INDEX_WHILE_BUILDING` is also
# enabled.
SWIFT_FEATURE_INDEX_INCLUDE_LOCALS = "swift.index_include_locals"

# If enabled, indexing will be completely modular - PCMs and Swift Modules will only
# be indexed when they are compiled. While indexing a module/PCM, none of its dependencies
# will be indexed.
Expand Down
9 changes: 9 additions & 0 deletions swift/toolchains/config/compile_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ load(
"SWIFT_FEATURE_FASTBUILD",
"SWIFT_FEATURE_FILE_PREFIX_MAP",
"SWIFT_FEATURE_FULL_DEBUG_INFO",
"SWIFT_FEATURE_INDEX_INCLUDE_LOCALS",
"SWIFT_FEATURE_INDEX_SYSTEM_MODULES",
"SWIFT_FEATURE_INDEX_WHILE_BUILDING",
"SWIFT_FEATURE_INTERNALIZE_AT_LINK",
Expand Down Expand Up @@ -744,6 +745,14 @@ def compile_action_configs(
configurators = [_index_while_building_configurator],
features = [SWIFT_FEATURE_INDEX_WHILE_BUILDING],
),
ActionConfigInfo(
actions = [SWIFT_ACTION_COMPILE],
configurators = [add_arg("-index-include-locals")],
features = [
SWIFT_FEATURE_INDEX_WHILE_BUILDING,
SWIFT_FEATURE_INDEX_INCLUDE_LOCALS,
],
),
ActionConfigInfo(
actions = [SWIFT_ACTION_COMPILE],
configurators = [add_arg("-index-ignore-system-modules")],
Expand Down

1 comment on commit c9b81c0

@brentleyjones
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.