File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,10 @@ def all_action_names():
6262 SWIFT_ACTION_SYMBOL_GRAPH_EXTRACT ,
6363 SWIFT_ACTION_SYNTHESIZE_INTERFACE ,
6464 )
65+
66+ def all_compile_action_names ():
67+ """Returns all actions that compile source files."""
68+ return [
69+ SWIFT_ACTION_COMPILE ,
70+ SWIFT_ACTION_COMPILE_MODULE_INTERFACE ,
71+ ]
Original file line number Diff line number Diff line change 2626 "SWIFT_ACTION_PRECOMPILE_C_MODULE" ,
2727 "SWIFT_ACTION_SYMBOL_GRAPH_EXTRACT" ,
2828 "SWIFT_ACTION_SYNTHESIZE_INTERFACE" ,
29+ "all_compile_action_names" ,
2930)
3031load (
3132 "//swift/internal:developer_dirs.bzl" ,
@@ -642,6 +643,21 @@ def compile_action_configs(
642643 #### Flags controlling how Swift/Clang modular inputs are processed
643644
644645 action_configs += [
646+
647+ # When `-g` is passed to the compiler, the driver will pass
648+ # `-file-compilation-dir <CWD>` to the frontend, which in turn passes
649+ # `-ffile-compilation-dir <CWD>` to Clang. This CWD is fully resolved so
650+ # it contains the absolute path to the workspace. If we pass
651+ # `-file-compilation-dir .`, then the driver/frontend preserve that
652+ # spelling, ensuring that the ClangImporter options section of the
653+ # `.swiftmodule` file is hermetic.
654+ ActionConfigInfo (
655+ actions = all_compile_action_names (),
656+ configurators = [
657+ add_arg ("-file-compilation-dir" , "." ),
658+ ],
659+ ),
660+
645661 # Treat paths in .modulemap files as workspace-relative, not modulemap-
646662 # relative.
647663 ActionConfigInfo (
You can’t perform that action at this time.
0 commit comments