Przeglądaj źródła

Comma seperated selection of allowed phases for trace (#2963)

For `-trace_phase` flag, makes the selection of multiple phases possible
by separating them by comma.

**Example Usage:**
```
bazel run //explorer -- <program_location> --trace_file=... -trace_phase=source_program,execution
```
Prabhat Sachdeva 2 lat temu
rodzic
commit
3c7bca4115
2 zmienionych plików z 3 dodań i 1 usunięć
  1. 1 0
      explorer/lit_testdata/trace.carbon
  2. 2 1
      explorer/main.cpp

+ 1 - 0
explorer/lit_testdata/trace.carbon

@@ -16,6 +16,7 @@
 // RUN: %{explorer} --parser_debug --trace_file=- -trace_phase=declarations | %{FileCheck-allow-unmatched} --check-prefixes=NO-SOURCE,NO-NAMES,NO-PRELUDE,NO-FLOW,NO-TYPE,NO-UNFORMED,DECLS,NO-EXEC,NO-TIMING
 // RUN: %{explorer} --parser_debug --trace_file=- -trace_phase=timing | %{FileCheck-allow-unmatched} --check-prefixes=NO-SOURCE,NO-NAMES,NO-PRELUDE,NO-FLOW,NO-TYPE,NO-UNFORMED,NO-DECLS,NO-EXEC,TIMING
 // RUN: %{explorer} --parser_debug --trace_file=- -trace_phase=all | %{FileCheck-allow-unmatched} --check-prefixes=SOURCE,NAMES,NO-PRELUDE,FLOW,TYPE,UNFORMED,DECLS,EXEC,TIMING
+// RUN: %{explorer} --parser_debug --trace_file=- -trace_phase=source_program,declarations | %{FileCheck-allow-unmatched} --check-prefixes=SOURCE,NO-NAMES,NO-PRELUDE,NO-FLOW,NO-TYPE,NO-UNFORMED,DECLS,NO-EXEC,NO-TIMING
 // NO-SOURCE-NOT:STDOUT: ********** source program **********
 //        SOURCE:STDOUT: ********** source program **********
 // NO-SOURCE-NOT:STDOUT: interface TestInterface {

+ 2 - 1
explorer/main.cpp

@@ -78,7 +78,8 @@ auto ExplorerMain(int argc, char** argv, void* static_for_main_addr,
               ProgramPhase::Timing, "timing",
               "Include timing logs for each phase, indicating the time taken."),
           clEnumValN(ProgramPhase::All, "all",
-                     "Include trace output for all phases.")));
+                     "Include trace output for all phases.")),
+      cl::CommaSeparated);
 
   // Use the executable path as a base for the relative prelude path.
   std::string exe =