From 377e9a0968d9d2c96ce38fd3fbaa73d0f25052fb Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Wed, 13 Sep 2023 11:27:57 -0700 Subject: [PATCH] In the driver, --dump-semantics-ir -> --dump-sem-ir (#3218) And Semantics IR -> SemIR --- toolchain/check/BUILD | 4 +- toolchain/check/check_fuzzer.cpp | 2 +- .../testdata/basics/builtin_nodes.carbon | 2 +- .../multifile_raw_and_textual_ir.carbon | 2 +- .../testdata/basics/multifile_raw_ir.carbon | 2 +- .../testdata/basics/raw_and_textual_ir.carbon | 2 +- toolchain/check/testdata/basics/raw_ir.carbon | 2 +- .../check/testdata/basics/textual_ir.carbon | 2 +- toolchain/driver/driver.cpp | 38 +++++++++---------- toolchain/sem_ir/file_test.cpp | 2 +- toolchain/testing/file_test.cpp | 2 +- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/toolchain/check/BUILD b/toolchain/check/BUILD index 540362da25a0..6978598db04b 100644 --- a/toolchain/check/BUILD +++ b/toolchain/check/BUILD @@ -82,8 +82,8 @@ glob_sh_run( "$(location //toolchain/driver:carbon)", "compile", "--phase=check", - "--dump-semantics-ir", - "--dump-raw-semantics-ir", + "--dump-sem-ir", + "--dump-raw-sem-ir", ], data = ["//toolchain/driver:carbon"], file_exts = ["carbon"], diff --git a/toolchain/check/check_fuzzer.cpp b/toolchain/check/check_fuzzer.cpp index ea33a7ab65f0..1d54962d7b82 100644 --- a/toolchain/check/check_fuzzer.cpp +++ b/toolchain/check/check_fuzzer.cpp @@ -29,7 +29,7 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, llvm::raw_null_ostream null_ostream; Driver driver(fs, null_ostream, null_ostream); - // TODO: Get semantics-ir to a point where it can handle invalid parse trees + // TODO: Get checking to a point where it can handle invalid parse trees // without crashing. if (!driver.RunCommand({"compile", "--phase=parse", TestFileName})) { return 0; diff --git a/toolchain/check/testdata/basics/builtin_nodes.carbon b/toolchain/check/testdata/basics/builtin_nodes.carbon index f4ea562e1d0f..9c693f23c955 100644 --- a/toolchain/check/testdata/basics/builtin_nodes.carbon +++ b/toolchain/check/testdata/basics/builtin_nodes.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --phase=check --dump-raw-semantics-ir --builtin-semantics-ir %s +// ARGS: compile --phase=check --dump-raw-sem-ir --builtin-sem-ir %s // // AUTOUPDATE diff --git a/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon index 6d52656d559c..f94515a5d54d 100644 --- a/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/multifile_raw_and_textual_ir.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --phase=check --dump-semantics-ir --dump-raw-semantics-ir %s +// ARGS: compile --phase=check --dump-sem-ir --dump-raw-sem-ir %s // // Check that we can combine textual IR and raw IR dumping in one compile. // diff --git a/toolchain/check/testdata/basics/multifile_raw_ir.carbon b/toolchain/check/testdata/basics/multifile_raw_ir.carbon index ae68deae67d3..a36183d70943 100644 --- a/toolchain/check/testdata/basics/multifile_raw_ir.carbon +++ b/toolchain/check/testdata/basics/multifile_raw_ir.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --phase=check --dump-raw-semantics-ir %s +// ARGS: compile --phase=check --dump-raw-sem-ir %s // // Check that raw IR dumping works as expected. // diff --git a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon index 7ae9f57853cd..3469441d6aa7 100644 --- a/toolchain/check/testdata/basics/raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/raw_and_textual_ir.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --phase=check --dump-semantics-ir --dump-raw-semantics-ir %s +// ARGS: compile --phase=check --dump-sem-ir --dump-raw-sem-ir %s // // Check that we can combine textual IR and raw IR dumping in one compile. // diff --git a/toolchain/check/testdata/basics/raw_ir.carbon b/toolchain/check/testdata/basics/raw_ir.carbon index 34720547e62d..dacce96479c1 100644 --- a/toolchain/check/testdata/basics/raw_ir.carbon +++ b/toolchain/check/testdata/basics/raw_ir.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --phase=check --dump-raw-semantics-ir %s +// ARGS: compile --phase=check --dump-raw-sem-ir %s // // Check that raw IR dumping works as expected. // diff --git a/toolchain/check/testdata/basics/textual_ir.carbon b/toolchain/check/testdata/basics/textual_ir.carbon index 463c6a1e06d7..c44a2649f25d 100644 --- a/toolchain/check/testdata/basics/textual_ir.carbon +++ b/toolchain/check/testdata/basics/textual_ir.carbon @@ -2,7 +2,7 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// ARGS: compile --phase=check --dump-semantics-ir %s +// ARGS: compile --phase=check --dump-sem-ir %s // // Check that the command-line flag to dump textual IR works. // diff --git a/toolchain/driver/driver.cpp b/toolchain/driver/driver.cpp index f2f85d7925bf..70f17d4874b7 100644 --- a/toolchain/driver/driver.cpp +++ b/toolchain/driver/driver.cpp @@ -207,28 +207,28 @@ postorder. [&](auto& arg_b) { arg_b.Set(&preorder_parse_tree); }); b.AddFlag( { - .name = "dump-raw-semantics-ir", + .name = "dump-raw-sem-ir", .help = R"""( -Dump the raw JSON structure of semantics IR to stdout when built. +Dump the raw JSON structure of SemIR to stdout when built. )""", }, - [&](auto& arg_b) { arg_b.Set(&dump_raw_semantics_ir); }); + [&](auto& arg_b) { arg_b.Set(&dump_raw_sem_ir); }); b.AddFlag( { - .name = "dump-semantics-ir", + .name = "dump-sem-ir", .help = R"""( -Dump the semantics IR to stdout when built. +Dump the SemIR to stdout when built. )""", }, - [&](auto& arg_b) { arg_b.Set(&dump_semantics_ir); }); + [&](auto& arg_b) { arg_b.Set(&dump_sem_ir); }); b.AddFlag( { - .name = "builtin-semantics-ir", + .name = "builtin-sem-ir", .help = R"""( -Include the semantics IR for builtins when dumping it. +Include the SemIR for builtins when dumping it. )""", }, - [&](auto& arg_b) { arg_b.Set(&builtin_semantics_ir); }); + [&](auto& arg_b) { arg_b.Set(&builtin_sem_ir); }); b.AddFlag( { .name = "dump-llvm-ir", @@ -259,13 +259,13 @@ Dump the generated assembly to stdout after codegen. bool force_obj_output = false; bool dump_tokens = false; bool dump_parse_tree = false; - bool dump_raw_semantics_ir = false; - bool dump_semantics_ir = false; + bool dump_raw_sem_ir = false; + bool dump_sem_ir = false; bool dump_llvm_ir = false; bool dump_asm = false; bool stream_errors = false; bool preorder_parse_tree = false; - bool builtin_semantics_ir = false; + bool builtin_sem_ir = false; }; struct Driver::Options { @@ -357,9 +357,9 @@ auto Driver::ValidateCompileOptions(const CompileOptions& options) const } [[clang::fallthrough]]; case Phase::Parse: - if (options.dump_semantics_ir) { - error_stream_ << "ERROR: Requested dumping the semantics IR but " - "compile phase is limited to '" + if (options.dump_sem_ir) { + error_stream_ << "ERROR: Requested dumping the SemIR but compile phase " + "is limited to '" << options.phase << "'\n"; return false; } @@ -446,9 +446,9 @@ class Driver::CompilationUnit { consumer_->Flush(); CARBON_VLOG() << "*** Raw SemIR::File ***\n" << *sem_ir_ << "\n"; - if (options_.dump_raw_semantics_ir) { - sem_ir_->Print(driver_->output_stream_, options_.builtin_semantics_ir); - if (options_.dump_semantics_ir) { + if (options_.dump_raw_sem_ir) { + sem_ir_->Print(driver_->output_stream_, options_.builtin_sem_ir); + if (options_.dump_sem_ir) { driver_->output_stream_ << "\n"; } } @@ -457,7 +457,7 @@ class Driver::CompilationUnit { CARBON_VLOG() << "*** SemIR::File ***\n"; SemIR::FormatFile(*tokens_, *parse_tree_, *sem_ir_, *vlog_stream_); } - if (options_.dump_semantics_ir) { + if (options_.dump_sem_ir) { SemIR::FormatFile(*tokens_, *parse_tree_, *sem_ir_, driver_->output_stream_); } diff --git a/toolchain/sem_ir/file_test.cpp b/toolchain/sem_ir/file_test.cpp index ab25383b096e..a929d9e81291 100644 --- a/toolchain/sem_ir/file_test.cpp +++ b/toolchain/sem_ir/file_test.cpp @@ -33,7 +33,7 @@ TEST(SemIRTest, YAML) { TestRawOstream print_stream; Driver d(fs, print_stream, llvm::errs()); d.RunCommand( - {"compile", "--phase=check", "--dump-raw-semantics-ir", "test.carbon"}); + {"compile", "--phase=check", "--dump-raw-sem-ir", "test.carbon"}); // Matches the ID of a node. The numbers may change because of builtin // cross-references, so this code is only doing loose structural checks. diff --git a/toolchain/testing/file_test.cpp b/toolchain/testing/file_test.cpp index 696d22387ece..3855aef2dc7f 100644 --- a/toolchain/testing/file_test.cpp +++ b/toolchain/testing/file_test.cpp @@ -33,7 +33,7 @@ class ToolchainFileTest : public FileTestBase { auto GetDefaultArgs() -> llvm::SmallVector override { if (component_ == "check") { - return {"compile", "--phase=check", "--dump-semantics-ir", "%s"}; + return {"compile", "--phase=check", "--dump-sem-ir", "%s"}; } else if (component_ == "lex") { return {"compile", "--phase=lex", "--dump-tokens", "%s"}; } else if (component_ == "lower") {