Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions swift/internal/action_names.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,10 @@ def all_action_names():
SWIFT_ACTION_SYMBOL_GRAPH_EXTRACT,
SWIFT_ACTION_SYNTHESIZE_INTERFACE,
)

def all_compile_action_names():
"""Returns all actions that compile source files."""
return [
SWIFT_ACTION_COMPILE,
SWIFT_ACTION_COMPILE_MODULE_INTERFACE,
]
16 changes: 16 additions & 0 deletions swift/toolchains/config/compile_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ load(
"SWIFT_ACTION_PRECOMPILE_C_MODULE",
"SWIFT_ACTION_SYMBOL_GRAPH_EXTRACT",
"SWIFT_ACTION_SYNTHESIZE_INTERFACE",
"all_compile_action_names",
)
load(
"//swift/internal:developer_dirs.bzl",
Expand Down Expand Up @@ -642,6 +643,21 @@ def compile_action_configs(
#### Flags controlling how Swift/Clang modular inputs are processed

action_configs += [

# When `-g` is passed to the compiler, the driver will pass
# `-file-compilation-dir <CWD>` to the frontend, which in turn passes
# `-ffile-compilation-dir <CWD>` to Clang. This CWD is fully resolved so
# it contains the absolute path to the workspace. If we pass
# `-file-compilation-dir .`, then the driver/frontend preserve that
# spelling, ensuring that the ClangImporter options section of the
# `.swiftmodule` file is hermetic.
ActionConfigInfo(
actions = all_compile_action_names(),
configurators = [
add_arg("-file-compilation-dir", "."),
],
),

# Treat paths in .modulemap files as workspace-relative, not modulemap-
# relative.
ActionConfigInfo(
Expand Down