Преглед изворни кода

In the driver, --dump-semantics-ir -> --dump-sem-ir (#3218)

And Semantics IR -> SemIR
Jon Ross-Perkins пре 2 година
родитељ
комит
377e9a0968

+ 2 - 2
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"],

+ 1 - 1
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;

+ 1 - 1
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
 

+ 1 - 1
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.
 //

+ 1 - 1
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.
 //

+ 1 - 1
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.
 //

+ 1 - 1
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.
 //

+ 1 - 1
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.
 //

+ 19 - 19
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_);
     }

+ 1 - 1
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.

+ 1 - 1
toolchain/testing/file_test.cpp

@@ -33,7 +33,7 @@ class ToolchainFileTest : public FileTestBase {
 
   auto GetDefaultArgs() -> llvm::SmallVector<std::string> 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") {