Move the injection of the prelude compile to the driver. (#3877)

The `file_test` layer still adds it to the VFS and filters it from the
dump output, but the driver now injects it into the compilation unites
depending on the `--import-prelude` file (enabled by default).

This doesn't address improvements to how we find the prelude code, just
sinking the needed logic into the driver itself.
This commit is contained in:
Chandler Carruth
2024-04-10 09:40:53 +00:00
committed by GitHub
parent f54f53adf5
commit e8430dda81
5 changed files with 27 additions and 6 deletions
+6 -4
View File
@@ -52,11 +52,14 @@ class ToolchainFileTest : public FileTestBase {
llvm::SmallVector<std::string> args = {"compile",
"--phase=" + component_.str()};
// For `lex` and `parse`, we don't need to import the prelude. Suppress it
// to improve the dump output for the tests.
if (component_ == "lex") {
args.insert(args.end(), {"--dump-tokens", "%s"});
args.insert(args.end(), {"--no-prelude-import", "--dump-tokens", "%s"});
return args;
} else if (component_ == "parse") {
args.insert(args.end(), {"--dump-parse-tree", "%s"});
args.insert(args.end(),
{"--no-prelude-import", "--dump-parse-tree", "%s"});
return args;
}
@@ -69,8 +72,7 @@ class ToolchainFileTest : public FileTestBase {
<< test_name();
}
args.insert(args.end(), {"--exclude-dump-file-prefix=core/",
"core/prelude.carbon", "%s"});
args.insert(args.end(), {"--exclude-dump-file-prefix=core/", "%s"});
return args;
}