mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 17:31:07 +01:00
Refactor FindPreludeFiles into InstallPaths (#4268)
From the driver's perspective, `FindPreludeFiles` is closely tied to `compile`. This makes it difficult to refactor commands without affecting the test dependencies on `FindPreludeFiles`. `InstallPaths` seems like a decent home since it is responsible for the install structure. I'm switching to an `Error` return to allow callers to choose how to handle it (e.g., in file tests, we typically don't want the direct error stream).
This commit is contained in:
@@ -36,11 +36,7 @@ class ToolchainFileTest : public FileTestBase {
|
||||
auto Run(const llvm::SmallVector<llvm::StringRef>& test_args,
|
||||
llvm::vfs::InMemoryFileSystem& fs, llvm::raw_pwrite_stream& stdout,
|
||||
llvm::raw_pwrite_stream& stderr) -> ErrorOr<RunResult> override {
|
||||
auto prelude =
|
||||
Driver::FindPreludeFiles(installation_.core_package(), stderr);
|
||||
if (prelude.empty()) {
|
||||
return Error("Could not find prelude");
|
||||
}
|
||||
CARBON_ASSIGN_OR_RETURN(auto prelude, installation_.FindPreludeFiles());
|
||||
for (const auto& file : prelude) {
|
||||
CARBON_RETURN_IF_ERROR(AddFile(fs, file));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user