mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:31:05 +01:00
Add stdin to driver's streams, and refactor stream passing (#4812)
The language server needs stdin, and for tests we should be passing it around. My intent is to pass in a faux stdin to Driver for language server tests. As long as I'm adding a new parameter, I was looking at also changing the way streams are passed in to Driver for style (pointers since they're held past construction lifetime). Since these are all stored in DriverEnv, I thought it might be a net improvement to use the struct directly, getting more explicit parameter names and also removing the need for `SetFuzzing`. I'm trying here to avoid functional changes, but there are a couple additional fixes like removing an obsolete `find_insensitive` and refactoring how `ValidateOptions` handles errors (because it reduces the number of spots that operate on error_stream).
This commit is contained in:
@@ -147,7 +147,11 @@ auto TestCompile(llvm::StringRef source) -> bool {
|
||||
new llvm::vfs::InMemoryFileSystem;
|
||||
InstallPaths installation(
|
||||
InstallPaths::MakeForBazelRunfiles(Testing::GetExePath()));
|
||||
Driver driver(fs, &installation, llvm::outs(), llvm::errs());
|
||||
Driver driver({.fs = fs,
|
||||
.installation = &installation,
|
||||
.input_stream = nullptr,
|
||||
.output_stream = &llvm::outs(),
|
||||
.error_stream = &llvm::errs()});
|
||||
|
||||
AddPreludeFilesToVfs(installation, fs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user