diff --git a/swift/internal/compiling.bzl b/swift/internal/compiling.bzl index 3247a9cf7..332a7ded3 100644 --- a/swift/internal/compiling.bzl +++ b/swift/internal/compiling.bzl @@ -36,6 +36,7 @@ load( "SWIFT_FEATURE_COVERAGE_PREFIX_MAP", "SWIFT_FEATURE_DBG", "SWIFT_FEATURE_DEBUG_PREFIX_MAP", + "SWIFT_FEATURE_DISABLE_SYSTEM_INDEX", "SWIFT_FEATURE_EMIT_C_MODULE", "SWIFT_FEATURE_EMIT_SWIFTINTERFACE", "SWIFT_FEATURE_ENABLE_BATCH_MODE", @@ -717,6 +718,18 @@ def compile_action_configs(): configurators = [_index_while_building_configurator], features = [SWIFT_FEATURE_INDEX_WHILE_BUILDING], ), + swift_toolchain_config.action_config( + actions = [swift_action_names.COMPILE], + configurators = [ + swift_toolchain_config.add_arg( + "-index-ignore-system-modules", + ), + ], + features = [ + SWIFT_FEATURE_INDEX_WHILE_BUILDING, + SWIFT_FEATURE_DISABLE_SYSTEM_INDEX, + ], + ), # User-defined conditional compilation flags (defined for Swift; those # passed directly to ClangImporter are handled above). diff --git a/swift/internal/feature_names.bzl b/swift/internal/feature_names.bzl index f3412f61b..583e33178 100644 --- a/swift/internal/feature_names.bzl +++ b/swift/internal/feature_names.bzl @@ -102,6 +102,9 @@ SWIFT_FEATURE_FULL_DEBUG_INFO = "swift.full_debug_info" # If enabled, the compilation action for a target will produce an index store. SWIFT_FEATURE_INDEX_WHILE_BUILDING = "swift.index_while_building" +# If enabled the compilation action will not produce indexes for system modules. +SWIFT_FEATURE_DISABLE_SYSTEM_INDEX = "swift.disable_system_index" + # If enabled, Swift libraries, binaries, and tests will only have automatic # dependencies on the targets provided by the toolchain's # `required_implicit_deps` field but not those in the `optional_implicit_deps`