mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:51:07 +01:00
Add skeletal format subcommand. (#4383)
This extracts out the SourceBuffer handling of `-` in order to trivially share it. Note this still has a number of TODOs, it's just setting up the essential subcommand infrastructure, with some tests demonstrating that it at least does something.
This commit is contained in:
@@ -329,13 +329,9 @@ class CompilationUnit {
|
||||
|
||||
// Loads source and lexes it. Returns true on success.
|
||||
auto RunLex() -> void {
|
||||
LogCall("SourceBuffer::MakeFromFile", [&] {
|
||||
if (input_filename_ == "-") {
|
||||
source_ = SourceBuffer::MakeFromStdin(*consumer_);
|
||||
} else {
|
||||
source_ = SourceBuffer::MakeFromFile(driver_env_->fs, input_filename_,
|
||||
*consumer_);
|
||||
}
|
||||
LogCall("SourceBuffer::MakeFromFileOrStdin", [&] {
|
||||
source_ = SourceBuffer::MakeFromFileOrStdin(driver_env_->fs,
|
||||
input_filename_, *consumer_);
|
||||
});
|
||||
if (mem_usage_) {
|
||||
mem_usage_->Add("source_", source_->text().size(),
|
||||
|
||||
Reference in New Issue
Block a user