@@ -87,15 +87,6 @@ def getStdFlag(cfg, std):
87
87
return None
88
88
89
89
90
- _allModules = ["none" , "clang" ]
91
-
92
-
93
- def getModuleFlag (cfg , enable_modules ):
94
- if enable_modules in _allModules :
95
- return enable_modules
96
- return None
97
-
98
-
99
90
# fmt: off
100
91
DEFAULT_PARAMETERS = [
101
92
Parameter (
@@ -128,32 +119,25 @@ def getModuleFlag(cfg, enable_modules):
128
119
),
129
120
Parameter (
130
121
name = "enable_modules" ,
131
- choices = _allModules ,
122
+ choices = [ "none" , "clang" , "clang-lsv" ] ,
132
123
type = str ,
133
- help = "Whether to build the test suite with modules enabled. Select "
134
- "`clang` for Clang modules" ,
135
- default = lambda cfg : next (s for s in _allModules if getModuleFlag (cfg , s )),
136
- actions = lambda enable_modules : [
137
- AddFeature ("clang-modules-build" ),
138
- AddCompileFlag ("-fmodules" ),
139
- AddCompileFlag ("-fcxx-modules" ), # AppleClang disregards -fmodules entirely when compiling C++. This enables modules for C++.
124
+ help = "Whether to build the test suite with modules enabled. "
125
+ "Select `clang` for Clang modules, and 'clang-lsv' for Clang modules with Local Submodule Visibility." ,
126
+ default = "none" ,
127
+ actions = lambda modules : filter (None , [
128
+ AddFeature ("clang-modules-build" ) if modules in ("clang" , "clang-lsv" ) else None ,
129
+
130
+ # Note: AppleClang disregards -fmodules entirely when compiling C++, so we also pass -fcxx-modules
131
+ # to enable modules for C++.
132
+ AddCompileFlag ("-fmodules -fcxx-modules" ) if modules in ("clang" , "clang-lsv" ) else None ,
133
+
140
134
# Note: We use a custom modules cache path to make sure that we don't reuse
141
135
# the default one, which can be shared across CI builds with different
142
136
# configurations.
143
- AddCompileFlag (lambda cfg : f"-fmodules-cache-path={ cfg .test_exec_root } /ModuleCache" ),
144
- ]
145
- if enable_modules == "clang"
146
- else [],
147
- ),
148
- Parameter (
149
- name = "enable_modules_lsv" ,
150
- choices = [True , False ],
151
- type = bool ,
152
- default = False ,
153
- help = "Whether to enable Local Submodule Visibility in the Modules build." ,
154
- actions = lambda lsv : [] if not lsv else [
155
- AddCompileFlag ("-Xclang -fmodules-local-submodule-visibility" ),
156
- ],
137
+ AddCompileFlag (lambda cfg : f"-fmodules-cache-path={ cfg .test_exec_root } /ModuleCache" ) if modules in ("clang" , "clang-lsv" ) else None ,
138
+
139
+ AddCompileFlag ("-Xclang -fmodules-local-submodule-visibility" ) if modules == "clang-lsv" else None ,
140
+ ])
157
141
),
158
142
Parameter (
159
143
name = "enable_exceptions" ,
0 commit comments