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
```
This commit is contained in:
Prabhat Sachdeva
2023-06-30 22:06:50 +00:00
committed by GitHub
parent 45c185ebf7
commit 3c7bca4115
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -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
View File
@@ -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 =