================
@@ -131,13 +138,65 @@ def parseScript(test, preamble):
script += preamble
script += scriptInTest
+ has_std_module = False
+ has_std_compat_module = False
+ for module in modules:
+ if module == "std":
+ has_std_module = True
+ elif module == "std.compat":
+ has_std_compat_module = True
+ else:
+ script.insert(
+ 0,
+ f"echo \"The module '{module}' is not valid, use 'std' or
'std.compat'\"",
+ )
+ script.insert(1, "false")
+ return script
+
+ if modules:
+ # This flag is needed for both modules.
+ moduleCompileFlags.append("-fprebuilt-module-path=%T")
+
+ # Building the modules needs to happen before the other script commands
+ # are executed. Therefore the commands are added to the front of the
+ # list.
+ if has_std_compat_module:
+ script.insert(
+ 0,
+ "%dbg(MODULE std.compat) %{cxx} %{flags} %{compile_flags} "
----------------
ldionne wrote:
I'm not a big fan of introducing a new `%{module_flags}` substitution here.
Those are fundamental substitutions and we should try not to add new ones
unless strictly required, but in this case it's kind of a workaround for the
chicken-and-egg problem you mention. Instead, we could perhaps instead do
(pseudo-code):
```
%dbg(MODULE std.compat) %{cxx} %{flags} {substitutions['%{compile_flags}']}
```
Basically, we'd evaluate the `%{compile_flags}` substitution right here instead
of delaying it until the test actually runs. Then we could add `std.pcm` to
`%{compile_flags}` in a mechanism similar to `ADDITIONAL_COMPILE_FLAGS` and it
should all work.
https://github.com/llvm/llvm-project/pull/76246
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits