浏览代码

Add the ability to pipe trace output to a file. (#1183)

Breaks `--trace` into two flags:

- `--parser_debug`, which sets the parser debug level (which I haven't dug into piping with `--trace`, but seemed likely to be troublesome)
- `--trace_file`, which now the type checker and interpreter will use for trace information (note compile errors should use a different channel)

Most of the file edits are just mechanical testdata flag updates: `sed -i 's/--trace/--parser_debug --trace_file=-/' testdata/**/*.carbon`

To explain the output paths:

- parse/compile errors: stderr
- print() calls: stdout
- parser tracing: `--parser_debug` option, stdout (formerly stdout if `--trace`)
- type check/compile tracing: `--trace_file=<file>`, giving `-` uses stdout (formerly stdout if `--trace`)
- return code of executed Carbon code: `--trace_file` if set, stdout if not (formerly stdout always)
Jon Meow 4 年之前
父节点
当前提交
b87747306f
共有 100 个文件被更改,包括 307 次插入262 次删除
  1. 19 19
      executable_semantics/interpreter/exec_program.cpp
  2. 4 1
      executable_semantics/interpreter/exec_program.h
  3. 52 46
      executable_semantics/interpreter/interpreter.cpp
  4. 6 3
      executable_semantics/interpreter/interpreter.h
  5. 81 78
      executable_semantics/interpreter/type_checker.cpp
  6. 4 3
      executable_semantics/interpreter/type_checker.h
  7. 29 5
      executable_semantics/main.cpp
  8. 13 9
      executable_semantics/syntax/parse.cpp
  9. 3 3
      executable_semantics/syntax/parse.h
  10. 1 1
      executable_semantics/syntax/parse_and_lex_context.cpp
  11. 5 4
      executable_semantics/syntax/parse_and_lex_context.h
  12. 1 1
      executable_semantics/testdata/array/fail_index.carbon
  13. 1 1
      executable_semantics/testdata/array/fail_negative_size.carbon
  14. 1 1
      executable_semantics/testdata/array/fail_size_mismatch.carbon
  15. 1 1
      executable_semantics/testdata/array/index.carbon
  16. 1 1
      executable_semantics/testdata/array/nested.carbon
  17. 1 1
      executable_semantics/testdata/assignment_copy/destruct_original.carbon
  18. 1 1
      executable_semantics/testdata/assignment_copy/reassign_original.carbon
  19. 1 1
      executable_semantics/testdata/basic_syntax/choice.carbon
  20. 1 1
      executable_semantics/testdata/basic_syntax/fail_assign_to_function.carbon
  21. 1 1
      executable_semantics/testdata/basic_syntax/fail_assign_to_rval.carbon
  22. 1 1
      executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon
  23. 1 1
      executable_semantics/testdata/basic_syntax/fail_invalid_integer.carbon
  24. 1 1
      executable_semantics/testdata/basic_syntax/fail_invalid_var_expression.carbon
  25. 1 1
      executable_semantics/testdata/basic_syntax/fail_missing_var.carbon
  26. 1 1
      executable_semantics/testdata/basic_syntax/fail_nested_binding.carbon
  27. 1 1
      executable_semantics/testdata/basic_syntax/fail_unimplemented_example.carbon
  28. 1 1
      executable_semantics/testdata/basic_syntax/next.carbon
  29. 1 1
      executable_semantics/testdata/basic_syntax/not_compare_precedence.carbon
  30. 1 1
      executable_semantics/testdata/basic_syntax/placeholder_variable.carbon
  31. 1 1
      executable_semantics/testdata/basic_syntax/print.carbon
  32. 1 1
      executable_semantics/testdata/basic_syntax/record.carbon
  33. 1 1
      executable_semantics/testdata/basic_syntax/star.carbon
  34. 2 2
      executable_semantics/testdata/basic_syntax/trace.carbon
  35. 1 1
      executable_semantics/testdata/basic_syntax/var_tuple.carbon
  36. 1 1
      executable_semantics/testdata/basic_syntax/zero.carbon
  37. 1 1
      executable_semantics/testdata/block/empty.carbon
  38. 1 1
      executable_semantics/testdata/block/shadowing.carbon
  39. 1 1
      executable_semantics/testdata/class/assign.carbon
  40. 1 1
      executable_semantics/testdata/class/assign_member.carbon
  41. 1 1
      executable_semantics/testdata/class/bound_method.carbon
  42. 1 1
      executable_semantics/testdata/class/class_function.carbon
  43. 1 1
      executable_semantics/testdata/class/class_function_from_instance.carbon
  44. 1 1
      executable_semantics/testdata/class/class_function_value.carbon
  45. 1 1
      executable_semantics/testdata/class/fail_field_access_mismatch.carbon
  46. 1 1
      executable_semantics/testdata/class/fail_field_mismatch.carbon
  47. 1 1
      executable_semantics/testdata/class/fail_field_missing.carbon
  48. 1 1
      executable_semantics/testdata/class/fail_method_from_class.carbon
  49. 1 1
      executable_semantics/testdata/class/function_param.carbon
  50. 1 1
      executable_semantics/testdata/class/global_var.carbon
  51. 1 1
      executable_semantics/testdata/class/method.carbon
  52. 1 1
      executable_semantics/testdata/class/method_call_method.carbon
  53. 1 1
      executable_semantics/testdata/class/temp.carbon
  54. 1 1
      executable_semantics/testdata/class/var.carbon
  55. 1 1
      executable_semantics/testdata/experimental_continuation/await_maintains_scope.carbon
  56. 1 1
      executable_semantics/testdata/experimental_continuation/creation_is_noop.carbon
  57. 1 1
      executable_semantics/testdata/experimental_continuation/fail_continuation_syntax.carbon
  58. 1 1
      executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon
  59. 1 1
      executable_semantics/testdata/experimental_continuation/recursive.carbon
  60. 1 1
      executable_semantics/testdata/experimental_continuation/run.carbon
  61. 1 1
      executable_semantics/testdata/experimental_continuation/run_with_await.carbon
  62. 1 1
      executable_semantics/testdata/experimental_continuation/shallow_copy.carbon
  63. 1 1
      executable_semantics/testdata/function/auto_return/add.carbon
  64. 1 1
      executable_semantics/testdata/function/auto_return/fail_direct_recurse.carbon
  65. 1 1
      executable_semantics/testdata/function/auto_return/fail_multiple_returns.carbon
  66. 1 1
      executable_semantics/testdata/function/auto_return/fail_no_return.carbon
  67. 1 1
      executable_semantics/testdata/function/auto_return/fail_separate_decl.carbon
  68. 1 1
      executable_semantics/testdata/function/auto_return/modify_arg_type.carbon
  69. 1 1
      executable_semantics/testdata/function/auto_return/modify_return_type.carbon
  70. 1 1
      executable_semantics/testdata/function/auto_return/type.carbon
  71. 1 1
      executable_semantics/testdata/function/empty_params.carbon
  72. 1 1
      executable_semantics/testdata/function/fail_call_with_tuple.carbon
  73. 1 1
      executable_semantics/testdata/function/fail_match_no_return.carbon
  74. 1 1
      executable_semantics/testdata/function/fail_match_partial_return.carbon
  75. 1 1
      executable_semantics/testdata/function/fail_non_exhaustive_match.carbon
  76. 1 1
      executable_semantics/testdata/function/fnty.carbon
  77. 1 1
      executable_semantics/testdata/function/ignored_parameter.carbon
  78. 1 1
      executable_semantics/testdata/function/multiple_args.carbon
  79. 1 1
      executable_semantics/testdata/function/param_lifetime.carbon
  80. 1 1
      executable_semantics/testdata/function/recursive.carbon
  81. 1 1
      executable_semantics/testdata/function/return.carbon
  82. 1 1
      executable_semantics/testdata/function/return_exhaustive_match.carbon
  83. 1 1
      executable_semantics/testdata/function/type_match.carbon
  84. 1 1
      executable_semantics/testdata/generic_class/class_function.carbon
  85. 1 1
      executable_semantics/testdata/generic_class/fail_argument_deduction.carbon
  86. 1 1
      executable_semantics/testdata/generic_class/fail_bad_parameter_type.carbon
  87. 1 1
      executable_semantics/testdata/generic_class/fail_field_access_on_generic.carbon
  88. 1 1
      executable_semantics/testdata/generic_class/fail_generic_in_pattern.carbon
  89. 1 1
      executable_semantics/testdata/generic_class/fail_instantiate_non_generic.carbon
  90. 1 1
      executable_semantics/testdata/generic_class/fail_point_equal.carbon
  91. 1 1
      executable_semantics/testdata/generic_class/generic_class_substitution.carbon
  92. 1 1
      executable_semantics/testdata/generic_class/generic_fun_and_class.carbon
  93. 1 1
      executable_semantics/testdata/generic_class/generic_point.carbon
  94. 1 1
      executable_semantics/testdata/generic_class/point_with_interface.carbon
  95. 1 1
      executable_semantics/testdata/generic_function/apply.carbon
  96. 1 1
      executable_semantics/testdata/generic_function/fail_not_addable.carbon
  97. 1 1
      executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon
  98. 1 1
      executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon
  99. 1 1
      executable_semantics/testdata/generic_function/non_generic_param.carbon
  100. 1 1
      executable_semantics/testdata/generic_function/return_val.carbon

+ 19 - 19
executable_semantics/interpreter/exec_program.cpp

@@ -17,11 +17,13 @@
 
 
 namespace Carbon {
 namespace Carbon {
 
 
-auto ExecProgram(Nonnull<Arena*> arena, AST ast, bool trace) -> ErrorOr<int> {
-  if (trace) {
-    llvm::outs() << "********** source program **********\n";
+auto ExecProgram(Nonnull<Arena*> arena, AST ast,
+                 std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
+    -> ErrorOr<int> {
+  if (trace_stream) {
+    **trace_stream << "********** source program **********\n";
     for (const auto decl : ast.declarations) {
     for (const auto decl : ast.declarations) {
-      llvm::outs() << *decl;
+      **trace_stream << *decl;
     }
     }
   }
   }
   SourceLocation source_loc("<Main()>", 0);
   SourceLocation source_loc("<Main()>", 0);
@@ -30,29 +32,27 @@ auto ExecProgram(Nonnull<Arena*> arena, AST ast, bool trace) -> ErrorOr<int> {
       arena->New<TupleLiteral>(source_loc));
       arena->New<TupleLiteral>(source_loc));
   // Although name resolution is currently done once, generic programming
   // Although name resolution is currently done once, generic programming
   // (particularly templates) may require more passes.
   // (particularly templates) may require more passes.
-  if (trace) {
-    llvm::outs() << "********** resolving names **********\n";
+  if (trace_stream) {
+    **trace_stream << "********** resolving names **********\n";
   }
   }
   RETURN_IF_ERROR(ResolveNames(ast));
   RETURN_IF_ERROR(ResolveNames(ast));
-  if (trace) {
-    llvm::outs() << "********** resolving control flow **********\n";
+  if (trace_stream) {
+    **trace_stream << "********** resolving control flow **********\n";
   }
   }
   RETURN_IF_ERROR(ResolveControlFlow(ast));
   RETURN_IF_ERROR(ResolveControlFlow(ast));
-  if (trace) {
-    llvm::outs() << "********** type checking **********\n";
+  if (trace_stream) {
+    **trace_stream << "********** type checking **********\n";
   }
   }
-  RETURN_IF_ERROR(TypeChecker(arena, trace).TypeCheck(ast));
-  if (trace) {
-    llvm::outs() << "\n";
-    llvm::outs() << "********** type checking complete **********\n";
+  RETURN_IF_ERROR(TypeChecker(arena, trace_stream).TypeCheck(ast));
+  if (trace_stream) {
+    **trace_stream << "\n";
+    **trace_stream << "********** type checking complete **********\n";
     for (const auto decl : ast.declarations) {
     for (const auto decl : ast.declarations) {
-      llvm::outs() << *decl;
+      **trace_stream << *decl;
     }
     }
-    llvm::outs() << "********** starting execution **********\n";
+    **trace_stream << "********** starting execution **********\n";
   }
   }
-  ASSIGN_OR_RETURN(const int result, InterpProgram(ast, arena, trace));
-  llvm::outs() << "result: " << result << "\n";
-  return result;
+  return InterpProgram(ast, arena, trace_stream);
 }
 }
 
 
 }  // namespace Carbon
 }  // namespace Carbon

+ 4 - 1
executable_semantics/interpreter/exec_program.h

@@ -10,11 +10,14 @@
 #define EXECUTABLE_SEMANTICS_INTERPRETER_EXEC_PROGRAM_H_
 #define EXECUTABLE_SEMANTICS_INTERPRETER_EXEC_PROGRAM_H_
 
 
 #include "executable_semantics/ast/ast.h"
 #include "executable_semantics/ast/ast.h"
+#include "llvm/Support/raw_ostream.h"
 
 
 namespace Carbon {
 namespace Carbon {
 
 
 // Runs the top-level declaration list.
 // Runs the top-level declaration list.
-auto ExecProgram(Nonnull<Arena*> arena, AST ast, bool trace) -> ErrorOr<int>;
+auto ExecProgram(Nonnull<Arena*> arena, AST ast,
+                 std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
+    -> ErrorOr<int>;
 
 
 }  // namespace Carbon
 }  // namespace Carbon
 
 

+ 52 - 46
executable_semantics/interpreter/interpreter.cpp

@@ -47,11 +47,12 @@ class Interpreter {
   // Constructs an Interpreter which allocates values on `arena`, and prints
   // Constructs an Interpreter which allocates values on `arena`, and prints
   // traces if `trace` is true. `phase` indicates whether it executes at
   // traces if `trace` is true. `phase` indicates whether it executes at
   // compile time or run time.
   // compile time or run time.
-  Interpreter(Phase phase, Nonnull<Arena*> arena, bool trace)
+  Interpreter(Phase phase, Nonnull<Arena*> arena,
+              std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
       : arena_(arena),
       : arena_(arena),
         heap_(arena),
         heap_(arena),
         todo_(MakeTodo(phase, &heap_)),
         todo_(MakeTodo(phase, &heap_)),
-        trace_(trace),
+        trace_stream_(trace_stream),
         phase_(phase) {}
         phase_(phase) {}
 
 
   ~Interpreter();
   ~Interpreter();
@@ -117,7 +118,7 @@ class Interpreter {
   // contents of any non-completed continuations at the end of execution.
   // contents of any non-completed continuations at the end of execution.
   std::vector<Nonnull<ContinuationValue::StackFragment*>> stack_fragments_;
   std::vector<Nonnull<ContinuationValue::StackFragment*>> stack_fragments_;
 
 
-  bool trace_;
+  std::optional<Nonnull<llvm::raw_ostream*>> trace_stream_;
   Phase phase_;
   Phase phase_;
 };
 };
 
 
@@ -283,9 +284,9 @@ auto PatternMatch(Nonnull<const Value*> p, Nonnull<const Value*> v,
 auto Interpreter::StepLvalue() -> ErrorOr<Success> {
 auto Interpreter::StepLvalue() -> ErrorOr<Success> {
   Action& act = todo_.CurrentAction();
   Action& act = todo_.CurrentAction();
   const Expression& exp = cast<LValAction>(act).expression();
   const Expression& exp = cast<LValAction>(act).expression();
-  if (trace_) {
-    llvm::outs() << "--- step lvalue " << exp << " (" << exp.source_loc()
-                 << ") --->\n";
+  if (trace_stream_) {
+    **trace_stream_ << "--- step lvalue " << exp << " (" << exp.source_loc()
+                    << ") --->\n";
   }
   }
   switch (exp.kind()) {
   switch (exp.kind()) {
     case ExpressionKind::IdentifierExpression: {
     case ExpressionKind::IdentifierExpression: {
@@ -373,13 +374,13 @@ auto Interpreter::StepLvalue() -> ErrorOr<Success> {
 auto Interpreter::InstantiateType(Nonnull<const Value*> type,
 auto Interpreter::InstantiateType(Nonnull<const Value*> type,
                                   SourceLocation source_loc) const
                                   SourceLocation source_loc) const
     -> ErrorOr<Nonnull<const Value*>> {
     -> ErrorOr<Nonnull<const Value*>> {
-  if (trace_) {
-    llvm::outs() << "instantiating: " << *type << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "instantiating: " << *type << "\n";
   }
   }
   switch (type->kind()) {
   switch (type->kind()) {
     case Value::Kind::VariableType: {
     case Value::Kind::VariableType: {
-      if (trace_) {
-        llvm::outs() << "case VariableType\n";
+      if (trace_stream_) {
+        **trace_stream_ << "case VariableType\n";
       }
       }
       ASSIGN_OR_RETURN(
       ASSIGN_OR_RETURN(
           Nonnull<const Value*> value,
           Nonnull<const Value*> value,
@@ -390,8 +391,8 @@ auto Interpreter::InstantiateType(Nonnull<const Value*> type,
       return value;
       return value;
     }
     }
     case Value::Kind::NominalClassType: {
     case Value::Kind::NominalClassType: {
-      if (trace_) {
-        llvm::outs() << "case NominalClassType\n";
+      if (trace_stream_) {
+        **trace_stream_ << "case NominalClassType\n";
       }
       }
       const auto& class_type = cast<NominalClassType>(*type);
       const auto& class_type = cast<NominalClassType>(*type);
       BindingMap inst_type_args;
       BindingMap inst_type_args;
@@ -399,15 +400,15 @@ auto Interpreter::InstantiateType(Nonnull<const Value*> type,
         ASSIGN_OR_RETURN(inst_type_args[ty_var],
         ASSIGN_OR_RETURN(inst_type_args[ty_var],
                          InstantiateType(ty_arg, source_loc));
                          InstantiateType(ty_arg, source_loc));
       }
       }
-      if (trace_) {
-        llvm::outs() << "finished instantiating ty_arg\n";
+      if (trace_stream_) {
+        **trace_stream_ << "finished instantiating ty_arg\n";
       }
       }
       std::map<Nonnull<const ImplBinding*>, Nonnull<const Witness*>> witnesses;
       std::map<Nonnull<const ImplBinding*>, Nonnull<const Witness*>> witnesses;
       for (const auto& [bind, impl] : class_type.impls()) {
       for (const auto& [bind, impl] : class_type.impls()) {
         ASSIGN_OR_RETURN(Nonnull<const Value*> witness_addr,
         ASSIGN_OR_RETURN(Nonnull<const Value*> witness_addr,
                          todo_.ValueOfNode(impl, source_loc));
                          todo_.ValueOfNode(impl, source_loc));
-        if (trace_) {
-          llvm::outs() << "witness_addr: " << *witness_addr << "\n";
+        if (trace_stream_) {
+          **trace_stream_ << "witness_addr: " << *witness_addr << "\n";
         }
         }
         // If the witness came directly from an `impl` declaration (via
         // If the witness came directly from an `impl` declaration (via
         // `constant_value`), then it is a `Witness`. If the witness
         // `constant_value`), then it is a `Witness`. If the witness
@@ -428,8 +429,8 @@ auto Interpreter::InstantiateType(Nonnull<const Value*> type,
         }
         }
         witnesses[bind] = witness;
         witnesses[bind] = witness;
       }
       }
-      if (trace_) {
-        llvm::outs() << "finished finding witnesses\n";
+      if (trace_stream_) {
+        **trace_stream_ << "finished finding witnesses\n";
       }
       }
       return arena_->New<NominalClassType>(&class_type.declaration(),
       return arena_->New<NominalClassType>(&class_type.declaration(),
                                            inst_type_args, witnesses);
                                            inst_type_args, witnesses);
@@ -540,9 +541,9 @@ auto Interpreter::Convert(Nonnull<const Value*> value,
 auto Interpreter::StepExp() -> ErrorOr<Success> {
 auto Interpreter::StepExp() -> ErrorOr<Success> {
   Action& act = todo_.CurrentAction();
   Action& act = todo_.CurrentAction();
   const Expression& exp = cast<ExpressionAction>(act).expression();
   const Expression& exp = cast<ExpressionAction>(act).expression();
-  if (trace_) {
-    llvm::outs() << "--- step exp " << exp << " (" << exp.source_loc()
-                 << ") --->\n";
+  if (trace_stream_) {
+    **trace_stream_ << "--- step exp " << exp << " (" << exp.source_loc()
+                    << ") --->\n";
   }
   }
   switch (exp.kind()) {
   switch (exp.kind()) {
     case ExpressionKind::IndexExpression: {
     case ExpressionKind::IndexExpression: {
@@ -697,8 +698,9 @@ auto Interpreter::StepExp() -> ErrorOr<Success> {
             const FunctionValue& fun_val =
             const FunctionValue& fun_val =
                 cast<FunctionValue>(*act.results()[0]);
                 cast<FunctionValue>(*act.results()[0]);
             const FunctionDeclaration& function = fun_val.declaration();
             const FunctionDeclaration& function = fun_val.declaration();
-            if (trace_) {
-              llvm::outs() << "*** call function " << function.name() << "\n";
+            if (trace_stream_) {
+              **trace_stream_ << "*** call function " << function.name()
+                              << "\n";
             }
             }
             ASSIGN_OR_RETURN(Nonnull<const Value*> converted_args,
             ASSIGN_OR_RETURN(Nonnull<const Value*> converted_args,
                              Convert(act.results()[1],
                              Convert(act.results()[1],
@@ -920,9 +922,9 @@ auto Interpreter::StepExp() -> ErrorOr<Success> {
 auto Interpreter::StepPattern() -> ErrorOr<Success> {
 auto Interpreter::StepPattern() -> ErrorOr<Success> {
   Action& act = todo_.CurrentAction();
   Action& act = todo_.CurrentAction();
   const Pattern& pattern = cast<PatternAction>(act).pattern();
   const Pattern& pattern = cast<PatternAction>(act).pattern();
-  if (trace_) {
-    llvm::outs() << "--- step pattern " << pattern << " ("
-                 << pattern.source_loc() << ") --->\n";
+  if (trace_stream_) {
+    **trace_stream_ << "--- step pattern " << pattern << " ("
+                    << pattern.source_loc() << ") --->\n";
   }
   }
   switch (pattern.kind()) {
   switch (pattern.kind()) {
     case PatternKind::AutoPattern: {
     case PatternKind::AutoPattern: {
@@ -991,10 +993,10 @@ auto Interpreter::StepPattern() -> ErrorOr<Success> {
 auto Interpreter::StepStmt() -> ErrorOr<Success> {
 auto Interpreter::StepStmt() -> ErrorOr<Success> {
   Action& act = todo_.CurrentAction();
   Action& act = todo_.CurrentAction();
   const Statement& stmt = cast<StatementAction>(act).statement();
   const Statement& stmt = cast<StatementAction>(act).statement();
-  if (trace_) {
-    llvm::outs() << "--- step stmt ";
-    stmt.PrintDepth(1, llvm::outs());
-    llvm::outs() << " (" << stmt.source_loc() << ") --->\n";
+  if (trace_stream_) {
+    **trace_stream_ << "--- step stmt ";
+    stmt.PrintDepth(1, **trace_stream_);
+    **trace_stream_ << " (" << stmt.source_loc() << ") --->\n";
   }
   }
   switch (stmt.kind()) {
   switch (stmt.kind()) {
     case StatementKind::Match: {
     case StatementKind::Match: {
@@ -1211,8 +1213,9 @@ auto Interpreter::StepStmt() -> ErrorOr<Success> {
 auto Interpreter::StepDeclaration() -> ErrorOr<Success> {
 auto Interpreter::StepDeclaration() -> ErrorOr<Success> {
   Action& act = todo_.CurrentAction();
   Action& act = todo_.CurrentAction();
   const Declaration& decl = cast<DeclarationAction>(act).declaration();
   const Declaration& decl = cast<DeclarationAction>(act).declaration();
-  if (trace_) {
-    llvm::outs() << "--- step declaration (" << decl.source_loc() << ") --->\n";
+  if (trace_stream_) {
+    **trace_stream_ << "--- step declaration (" << decl.source_loc()
+                    << ") --->\n";
   }
   }
   switch (decl.kind()) {
   switch (decl.kind()) {
     case DeclarationKind::VariableDeclaration: {
     case DeclarationKind::VariableDeclaration: {
@@ -1266,24 +1269,25 @@ auto Interpreter::Step() -> ErrorOr<Success> {
 
 
 auto Interpreter::RunAllSteps(std::unique_ptr<Action> action)
 auto Interpreter::RunAllSteps(std::unique_ptr<Action> action)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    PrintState(llvm::outs());
+  if (trace_stream_) {
+    PrintState(**trace_stream_);
   }
   }
   todo_.Start(std::move(action));
   todo_.Start(std::move(action));
   while (!todo_.IsEmpty()) {
   while (!todo_.IsEmpty()) {
     RETURN_IF_ERROR(Step());
     RETURN_IF_ERROR(Step());
-    if (trace_) {
-      PrintState(llvm::outs());
+    if (trace_stream_) {
+      PrintState(**trace_stream_);
     }
     }
   }
   }
   return Success();
   return Success();
 }
 }
 
 
-auto InterpProgram(const AST& ast, Nonnull<Arena*> arena, bool trace)
+auto InterpProgram(const AST& ast, Nonnull<Arena*> arena,
+                   std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
     -> ErrorOr<int> {
     -> ErrorOr<int> {
-  Interpreter interpreter(Phase::RunTime, arena, trace);
-  if (trace) {
-    llvm::outs() << "********** initializing globals **********\n";
+  Interpreter interpreter(Phase::RunTime, arena, trace_stream);
+  if (trace_stream) {
+    **trace_stream << "********** initializing globals **********\n";
   }
   }
 
 
   for (Nonnull<Declaration*> declaration : ast.declarations) {
   for (Nonnull<Declaration*> declaration : ast.declarations) {
@@ -1291,8 +1295,8 @@ auto InterpProgram(const AST& ast, Nonnull<Arena*> arena, bool trace)
         std::make_unique<DeclarationAction>(declaration)));
         std::make_unique<DeclarationAction>(declaration)));
   }
   }
 
 
-  if (trace) {
-    llvm::outs() << "********** calling main function **********\n";
+  if (trace_stream) {
+    **trace_stream << "********** calling main function **********\n";
   }
   }
 
 
   RETURN_IF_ERROR(interpreter.RunAllSteps(
   RETURN_IF_ERROR(interpreter.RunAllSteps(
@@ -1301,17 +1305,19 @@ auto InterpProgram(const AST& ast, Nonnull<Arena*> arena, bool trace)
   return cast<IntValue>(*interpreter.result()).value();
   return cast<IntValue>(*interpreter.result()).value();
 }
 }
 
 
-auto InterpExp(Nonnull<const Expression*> e, Nonnull<Arena*> arena, bool trace)
+auto InterpExp(Nonnull<const Expression*> e, Nonnull<Arena*> arena,
+               std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
     -> ErrorOr<Nonnull<const Value*>> {
     -> ErrorOr<Nonnull<const Value*>> {
-  Interpreter interpreter(Phase::CompileTime, arena, trace);
+  Interpreter interpreter(Phase::CompileTime, arena, trace_stream);
   RETURN_IF_ERROR(
   RETURN_IF_ERROR(
       interpreter.RunAllSteps(std::make_unique<ExpressionAction>(e)));
       interpreter.RunAllSteps(std::make_unique<ExpressionAction>(e)));
   return interpreter.result();
   return interpreter.result();
 }
 }
 
 
-auto InterpPattern(Nonnull<const Pattern*> p, Nonnull<Arena*> arena, bool trace)
+auto InterpPattern(Nonnull<const Pattern*> p, Nonnull<Arena*> arena,
+                   std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
     -> ErrorOr<Nonnull<const Value*>> {
     -> ErrorOr<Nonnull<const Value*>> {
-  Interpreter interpreter(Phase::CompileTime, arena, trace);
+  Interpreter interpreter(Phase::CompileTime, arena, trace_stream);
   RETURN_IF_ERROR(interpreter.RunAllSteps(std::make_unique<PatternAction>(p)));
   RETURN_IF_ERROR(interpreter.RunAllSteps(std::make_unique<PatternAction>(p)));
   return interpreter.result();
   return interpreter.result();
 }
 }

+ 6 - 3
executable_semantics/interpreter/interpreter.h

@@ -23,19 +23,22 @@ namespace Carbon {
 
 
 // Interprets the program defined by `ast`, allocating values on `arena` and
 // Interprets the program defined by `ast`, allocating values on `arena` and
 // printing traces if `trace` is true.
 // printing traces if `trace` is true.
-auto InterpProgram(const AST& ast, Nonnull<Arena*> arena, bool trace)
+auto InterpProgram(const AST& ast, Nonnull<Arena*> arena,
+                   std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
     -> ErrorOr<int>;
     -> ErrorOr<int>;
 
 
 // Interprets `e` at compile-time, allocating values on `arena` and
 // Interprets `e` at compile-time, allocating values on `arena` and
 // printing traces if `trace` is true. The caller must ensure that all the
 // printing traces if `trace` is true. The caller must ensure that all the
 // code this evaluates has been typechecked.
 // code this evaluates has been typechecked.
-auto InterpExp(Nonnull<const Expression*> e, Nonnull<Arena*> arena, bool trace)
+auto InterpExp(Nonnull<const Expression*> e, Nonnull<Arena*> arena,
+               std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
     -> ErrorOr<Nonnull<const Value*>>;
     -> ErrorOr<Nonnull<const Value*>>;
 
 
 // Interprets `p` at compile-time, allocating values on `arena` and
 // Interprets `p` at compile-time, allocating values on `arena` and
 // printing traces if `trace` is true. The caller must ensure that all the
 // printing traces if `trace` is true. The caller must ensure that all the
 // code this evaluates has been typechecked.
 // code this evaluates has been typechecked.
-auto InterpPattern(Nonnull<const Pattern*> p, Nonnull<Arena*> arena, bool trace)
+auto InterpPattern(Nonnull<const Pattern*> p, Nonnull<Arena*> arena,
+                   std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
     -> ErrorOr<Nonnull<const Value*>>;
     -> ErrorOr<Nonnull<const Value*>>;
 
 
 // Attempts to match `v` against the pattern `p`, returning whether matching
 // Attempts to match `v` against the pattern `p`, returning whether matching

+ 81 - 78
executable_semantics/interpreter/type_checker.cpp

@@ -432,9 +432,9 @@ auto TypeChecker::Substitute(
       }
       }
       Nonnull<const NominalClassType*> new_class_type =
       Nonnull<const NominalClassType*> new_class_type =
           arena_->New<NominalClassType>(&class_type.declaration(), type_args);
           arena_->New<NominalClassType>(&class_type.declaration(), type_args);
-      if (trace_) {
-        llvm::outs() << "substitution: " << class_type << " => "
-                     << *new_class_type << "\n";
+      if (trace_stream_) {
+        **trace_stream_ << "substitution: " << class_type << " => "
+                        << *new_class_type << "\n";
       }
       }
       return new_class_type;
       return new_class_type;
     }
     }
@@ -473,11 +473,11 @@ auto TypeChecker::Substitute(
 auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
 auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
                                const ImplScope& impl_scope)
                                const ImplScope& impl_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "checking expression " << *e;
-    llvm::outs() << "\nconstants: ";
-    PrintConstants(llvm::outs());
-    llvm::outs() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "checking expression " << *e;
+    **trace_stream_ << "\nconstants: ";
+    PrintConstants(**trace_stream_);
+    **trace_stream_ << "\n";
   }
   }
   switch (e->kind()) {
   switch (e->kind()) {
     case ExpressionKind::IndexExpression: {
     case ExpressionKind::IndexExpression: {
@@ -492,7 +492,7 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
                                           "tuple index", arena_->New<IntType>(),
                                           "tuple index", arena_->New<IntType>(),
                                           &index.offset().static_type()));
                                           &index.offset().static_type()));
           ASSIGN_OR_RETURN(auto offset_value,
           ASSIGN_OR_RETURN(auto offset_value,
-                           InterpExp(&index.offset(), arena_, trace_));
+                           InterpExp(&index.offset(), arena_, trace_stream_));
           int i = cast<IntValue>(*offset_value).value();
           int i = cast<IntValue>(*offset_value).value();
           if (i < 0 || i >= static_cast<int>(tuple_type.elements().size())) {
           if (i < 0 || i >= static_cast<int>(tuple_type.elements().size())) {
             return CompilationError(e->source_loc())
             return CompilationError(e->source_loc())
@@ -541,7 +541,7 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
       for (auto& arg : struct_type.fields()) {
       for (auto& arg : struct_type.fields()) {
         RETURN_IF_ERROR(TypeCheckExp(&arg.expression(), impl_scope));
         RETURN_IF_ERROR(TypeCheckExp(&arg.expression(), impl_scope));
         ASSIGN_OR_RETURN(auto value,
         ASSIGN_OR_RETURN(auto value,
-                         InterpExp(&arg.expression(), arena_, trace_));
+                         InterpExp(&arg.expression(), arena_, trace_stream_));
         RETURN_IF_ERROR(
         RETURN_IF_ERROR(
             ExpectIsConcreteType(arg.expression().source_loc(), value));
             ExpectIsConcreteType(arg.expression().source_loc(), value));
       }
       }
@@ -690,8 +690,9 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
           // If `T` is a type variable and `foo` is a class function in an
           // If `T` is a type variable and `foo` is a class function in an
           // interface implemented by `T`, then `T.foo` accesses the `foo` class
           // interface implemented by `T`, then `T.foo` accesses the `foo` class
           // function of `T`.
           // function of `T`.
-          ASSIGN_OR_RETURN(Nonnull<const Value*> var_addr,
-                           InterpExp(&access.aggregate(), arena_, trace_));
+          ASSIGN_OR_RETURN(
+              Nonnull<const Value*> var_addr,
+              InterpExp(&access.aggregate(), arena_, trace_stream_));
           const VariableType& var_type = cast<VariableType>(*var_addr);
           const VariableType& var_type = cast<VariableType>(*var_addr);
           const InterfaceType& iface_type = cast<InterfaceType>(aggregate_type);
           const InterfaceType& iface_type = cast<InterfaceType>(aggregate_type);
           const InterfaceDeclaration& iface_decl = iface_type.declaration();
           const InterfaceDeclaration& iface_decl = iface_type.declaration();
@@ -903,11 +904,12 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
                   .declaration();
                   .declaration();
           BindingMap generic_args;
           BindingMap generic_args;
           if (class_decl.type_params().has_value()) {
           if (class_decl.type_params().has_value()) {
-            if (trace_) {
-              llvm::outs() << "pattern matching type params and args ";
+            if (trace_stream_) {
+              **trace_stream_ << "pattern matching type params and args ";
             }
             }
-            ASSIGN_OR_RETURN(Nonnull<const Value*> arg,
-                             InterpExp(&call.argument(), arena_, trace_));
+            ASSIGN_OR_RETURN(
+                Nonnull<const Value*> arg,
+                InterpExp(&call.argument(), arena_, trace_stream_));
             CHECK(PatternMatch(&(*class_decl.type_params())->value(), arg,
             CHECK(PatternMatch(&(*class_decl.type_params())->value(), arg,
                                call.source_loc(), std::nullopt, generic_args));
                                call.source_loc(), std::nullopt, generic_args));
           } else {
           } else {
@@ -957,11 +959,11 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
     case ExpressionKind::FunctionTypeLiteral: {
     case ExpressionKind::FunctionTypeLiteral: {
       auto& fn = cast<FunctionTypeLiteral>(*e);
       auto& fn = cast<FunctionTypeLiteral>(*e);
       ASSIGN_OR_RETURN(Nonnull<const Value*> param_type,
       ASSIGN_OR_RETURN(Nonnull<const Value*> param_type,
-                       InterpExp(&fn.parameter(), arena_, trace_));
+                       InterpExp(&fn.parameter(), arena_, trace_stream_));
       RETURN_IF_ERROR(
       RETURN_IF_ERROR(
           ExpectIsConcreteType(fn.parameter().source_loc(), param_type));
           ExpectIsConcreteType(fn.parameter().source_loc(), param_type));
       ASSIGN_OR_RETURN(Nonnull<const Value*> ret_type,
       ASSIGN_OR_RETURN(Nonnull<const Value*> ret_type,
-                       InterpExp(&fn.return_type(), arena_, trace_));
+                       InterpExp(&fn.return_type(), arena_, trace_stream_));
       RETURN_IF_ERROR(
       RETURN_IF_ERROR(
           ExpectIsConcreteType(fn.return_type().source_loc(), ret_type));
           ExpectIsConcreteType(fn.return_type().source_loc(), ret_type));
       fn.set_static_type(arena_->New<TypeType>());
       fn.set_static_type(arena_->New<TypeType>());
@@ -1022,9 +1024,9 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
       auto& array_literal = cast<ArrayTypeLiteral>(*e);
       auto& array_literal = cast<ArrayTypeLiteral>(*e);
       RETURN_IF_ERROR(
       RETURN_IF_ERROR(
           TypeCheckExp(&array_literal.element_type_expression(), impl_scope));
           TypeCheckExp(&array_literal.element_type_expression(), impl_scope));
-      ASSIGN_OR_RETURN(
-          Nonnull<const Value*> element_type,
-          InterpExp(&array_literal.element_type_expression(), arena_, trace_));
+      ASSIGN_OR_RETURN(Nonnull<const Value*> element_type,
+                       InterpExp(&array_literal.element_type_expression(),
+                                 arena_, trace_stream_));
       RETURN_IF_ERROR(ExpectIsConcreteType(
       RETURN_IF_ERROR(ExpectIsConcreteType(
           array_literal.element_type_expression().source_loc(), element_type));
           array_literal.element_type_expression().source_loc(), element_type));
 
 
@@ -1036,7 +1038,7 @@ auto TypeChecker::TypeCheckExp(Nonnull<Expression*> e,
                           &array_literal.size_expression().static_type()));
                           &array_literal.size_expression().static_type()));
       ASSIGN_OR_RETURN(
       ASSIGN_OR_RETURN(
           Nonnull<const Value*> size_value,
           Nonnull<const Value*> size_value,
-          InterpExp(&array_literal.size_expression(), arena_, trace_));
+          InterpExp(&array_literal.size_expression(), arena_, trace_stream_));
       if (cast<IntValue>(size_value)->value() < 0) {
       if (cast<IntValue>(size_value)->value() < 0) {
         return CompilationError(array_literal.size_expression().source_loc())
         return CompilationError(array_literal.size_expression().source_loc())
                << "Array size cannot be negative";
                << "Array size cannot be negative";
@@ -1087,14 +1089,14 @@ auto TypeChecker::TypeCheckPattern(
     Nonnull<Pattern*> p, std::optional<Nonnull<const Value*>> expected,
     Nonnull<Pattern*> p, std::optional<Nonnull<const Value*>> expected,
     const ImplScope& impl_scope, ValueCategory enclosing_value_category)
     const ImplScope& impl_scope, ValueCategory enclosing_value_category)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "checking pattern " << *p;
+  if (trace_stream_) {
+    **trace_stream_ << "checking pattern " << *p;
     if (expected) {
     if (expected) {
-      llvm::outs() << ", expecting " << **expected;
+      **trace_stream_ << ", expecting " << **expected;
     }
     }
-    llvm::outs() << "\nconstants: ";
-    PrintConstants(llvm::outs());
-    llvm::outs() << "\n";
+    **trace_stream_ << "\nconstants: ";
+    PrintConstants(**trace_stream_);
+    **trace_stream_ << "\n";
   }
   }
   switch (p->kind()) {
   switch (p->kind()) {
     case PatternKind::AutoPattern: {
     case PatternKind::AutoPattern: {
@@ -1110,7 +1112,7 @@ auto TypeChecker::TypeCheckPattern(
       RETURN_IF_ERROR(TypeCheckPattern(&binding.type(), std::nullopt,
       RETURN_IF_ERROR(TypeCheckPattern(&binding.type(), std::nullopt,
                                        impl_scope, enclosing_value_category));
                                        impl_scope, enclosing_value_category));
       ASSIGN_OR_RETURN(Nonnull<const Value*> type,
       ASSIGN_OR_RETURN(Nonnull<const Value*> type,
-                       InterpPattern(&binding.type(), arena_, trace_));
+                       InterpPattern(&binding.type(), arena_, trace_stream_));
       if (expected) {
       if (expected) {
         if (IsConcreteType(type)) {
         if (IsConcreteType(type)) {
           RETURN_IF_ERROR(
           RETURN_IF_ERROR(
@@ -1129,7 +1131,7 @@ auto TypeChecker::TypeCheckPattern(
       RETURN_IF_ERROR(ExpectIsConcreteType(binding.source_loc(), type));
       RETURN_IF_ERROR(ExpectIsConcreteType(binding.source_loc(), type));
       binding.set_static_type(type);
       binding.set_static_type(type);
       ASSIGN_OR_RETURN(Nonnull<const Value*> binding_value,
       ASSIGN_OR_RETURN(Nonnull<const Value*> binding_value,
-                       InterpPattern(&binding, arena_, trace_));
+                       InterpPattern(&binding, arena_, trace_stream_));
       SetValue(&binding, binding_value);
       SetValue(&binding, binding_value);
 
 
       if (!binding.has_value_category()) {
       if (!binding.has_value_category()) {
@@ -1141,7 +1143,7 @@ auto TypeChecker::TypeCheckPattern(
       auto& binding = cast<GenericBinding>(*p);
       auto& binding = cast<GenericBinding>(*p);
       RETURN_IF_ERROR(TypeCheckExp(&binding.type(), impl_scope));
       RETURN_IF_ERROR(TypeCheckExp(&binding.type(), impl_scope));
       ASSIGN_OR_RETURN(Nonnull<const Value*> type,
       ASSIGN_OR_RETURN(Nonnull<const Value*> type,
-                       InterpExp(&binding.type(), arena_, trace_));
+                       InterpExp(&binding.type(), arena_, trace_stream_));
       if (expected) {
       if (expected) {
         return CompilationError(binding.type().source_loc())
         return CompilationError(binding.type().source_loc())
                << "Generic binding may not occur in pattern with expected "
                << "Generic binding may not occur in pattern with expected "
@@ -1150,7 +1152,7 @@ auto TypeChecker::TypeCheckPattern(
       }
       }
       binding.set_static_type(type);
       binding.set_static_type(type);
       ASSIGN_OR_RETURN(Nonnull<const Value*> val,
       ASSIGN_OR_RETURN(Nonnull<const Value*> val,
-                       InterpPattern(&binding, arena_, trace_));
+                       InterpPattern(&binding, arena_, trace_stream_));
       binding.set_symbolic_identity(val);
       binding.set_symbolic_identity(val);
       Nonnull<ImplBinding*> impl_binding = arena_->New<ImplBinding>(
       Nonnull<ImplBinding*> impl_binding = arena_->New<ImplBinding>(
           binding.source_loc(), &binding, &binding.static_type());
           binding.source_loc(), &binding, &binding.static_type());
@@ -1177,14 +1179,14 @@ auto TypeChecker::TypeCheckPattern(
         }
         }
         RETURN_IF_ERROR(TypeCheckPattern(field, expected_field_type, impl_scope,
         RETURN_IF_ERROR(TypeCheckPattern(field, expected_field_type, impl_scope,
                                          enclosing_value_category));
                                          enclosing_value_category));
-        if (trace_)
-          llvm::outs() << "finished checking tuple pattern field " << *field
-                       << "\n";
+        if (trace_stream_)
+          **trace_stream_ << "finished checking tuple pattern field " << *field
+                          << "\n";
         field_types.push_back(&field->static_type());
         field_types.push_back(&field->static_type());
       }
       }
       tuple.set_static_type(arena_->New<TupleValue>(std::move(field_types)));
       tuple.set_static_type(arena_->New<TupleValue>(std::move(field_types)));
       ASSIGN_OR_RETURN(Nonnull<const Value*> tuple_value,
       ASSIGN_OR_RETURN(Nonnull<const Value*> tuple_value,
-                       InterpPattern(&tuple, arena_, trace_));
+                       InterpPattern(&tuple, arena_, trace_stream_));
       SetValue(&tuple, tuple_value);
       SetValue(&tuple, tuple_value);
       return Success();
       return Success();
     }
     }
@@ -1217,7 +1219,7 @@ auto TypeChecker::TypeCheckPattern(
                                        enclosing_value_category));
                                        enclosing_value_category));
       alternative.set_static_type(&choice_type);
       alternative.set_static_type(&choice_type);
       ASSIGN_OR_RETURN(Nonnull<const Value*> alternative_value,
       ASSIGN_OR_RETURN(Nonnull<const Value*> alternative_value,
-                       InterpPattern(&alternative, arena_, trace_));
+                       InterpPattern(&alternative, arena_, trace_stream_));
       SetValue(&alternative, alternative_value);
       SetValue(&alternative, alternative_value);
       return Success();
       return Success();
     }
     }
@@ -1226,7 +1228,7 @@ auto TypeChecker::TypeCheckPattern(
       RETURN_IF_ERROR(TypeCheckExp(&expression, impl_scope));
       RETURN_IF_ERROR(TypeCheckExp(&expression, impl_scope));
       p->set_static_type(&expression.static_type());
       p->set_static_type(&expression.static_type());
       ASSIGN_OR_RETURN(Nonnull<const Value*> expr_value,
       ASSIGN_OR_RETURN(Nonnull<const Value*> expr_value,
-                       InterpPattern(p, arena_, trace_));
+                       InterpPattern(p, arena_, trace_stream_));
       SetValue(p, expr_value);
       SetValue(p, expr_value);
       return Success();
       return Success();
     }
     }
@@ -1238,7 +1240,7 @@ auto TypeChecker::TypeCheckPattern(
                                        let_var_pattern.value_category()));
                                        let_var_pattern.value_category()));
       let_var_pattern.set_static_type(&let_var_pattern.pattern().static_type());
       let_var_pattern.set_static_type(&let_var_pattern.pattern().static_type());
       ASSIGN_OR_RETURN(Nonnull<const Value*> pattern_value,
       ASSIGN_OR_RETURN(Nonnull<const Value*> pattern_value,
-                       InterpPattern(&let_var_pattern, arena_, trace_));
+                       InterpPattern(&let_var_pattern, arena_, trace_stream_));
       SetValue(&let_var_pattern, pattern_value);
       SetValue(&let_var_pattern, pattern_value);
       return Success();
       return Success();
   }
   }
@@ -1247,8 +1249,8 @@ auto TypeChecker::TypeCheckPattern(
 auto TypeChecker::TypeCheckStmt(Nonnull<Statement*> s,
 auto TypeChecker::TypeCheckStmt(Nonnull<Statement*> s,
                                 const ImplScope& impl_scope)
                                 const ImplScope& impl_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "checking statement " << *s << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "checking statement " << *s << "\n";
   }
   }
   switch (s->kind()) {
   switch (s->kind()) {
     case StatementKind::Match: {
     case StatementKind::Match: {
@@ -1438,15 +1440,15 @@ auto TypeChecker::ExpectReturnOnAllPaths(
 auto TypeChecker::DeclareFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
 auto TypeChecker::DeclareFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
                                              const ImplScope& enclosing_scope)
                                              const ImplScope& enclosing_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "** declaring function " << f->name() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** declaring function " << f->name() << "\n";
   }
   }
   // Bring the deduced parameters into scope
   // Bring the deduced parameters into scope
   for (Nonnull<GenericBinding*> deduced : f->deduced_parameters()) {
   for (Nonnull<GenericBinding*> deduced : f->deduced_parameters()) {
     RETURN_IF_ERROR(TypeCheckExp(&deduced->type(), enclosing_scope));
     RETURN_IF_ERROR(TypeCheckExp(&deduced->type(), enclosing_scope));
     deduced->set_symbolic_identity(arena_->New<VariableType>(deduced));
     deduced->set_symbolic_identity(arena_->New<VariableType>(deduced));
     ASSIGN_OR_RETURN(Nonnull<const Value*> type_of_type,
     ASSIGN_OR_RETURN(Nonnull<const Value*> type_of_type,
-                     InterpExp(&deduced->type(), arena_, trace_));
+                     InterpExp(&deduced->type(), arena_, trace_stream_));
     deduced->set_static_type(type_of_type);
     deduced->set_static_type(type_of_type);
   }
   }
   // Create the impl_bindings
   // Create the impl_bindings
@@ -1486,7 +1488,7 @@ auto TypeChecker::DeclareFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
     // Should we be doing SetConstantValue instead? -Jeremy
     // Should we be doing SetConstantValue instead? -Jeremy
     // And shouldn't the type of this be Type?
     // And shouldn't the type of this be Type?
     ASSIGN_OR_RETURN(Nonnull<const Value*> ret_type,
     ASSIGN_OR_RETURN(Nonnull<const Value*> ret_type,
-                     InterpExp(*return_expression, arena_, trace_));
+                     InterpExp(*return_expression, arena_, trace_stream_));
     f->return_term().set_static_type(ret_type);
     f->return_term().set_static_type(ret_type);
   } else if (f->return_term().is_omitted()) {
   } else if (f->return_term().is_omitted()) {
     f->return_term().set_static_type(TupleValue::Empty());
     f->return_term().set_static_type(TupleValue::Empty());
@@ -1520,9 +1522,9 @@ auto TypeChecker::DeclareFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
     // TODO: Check that main doesn't have any parameters.
     // TODO: Check that main doesn't have any parameters.
   }
   }
 
 
-  if (trace_) {
-    llvm::outs() << "** finished declaring function " << f->name()
-                 << " of type " << f->static_type() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** finished declaring function " << f->name()
+                    << " of type " << f->static_type() << "\n";
   }
   }
   return Success();
   return Success();
 }
 }
@@ -1530,8 +1532,8 @@ auto TypeChecker::DeclareFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
 auto TypeChecker::TypeCheckFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
 auto TypeChecker::TypeCheckFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
                                                const ImplScope& impl_scope)
                                                const ImplScope& impl_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "** checking function " << f->name() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** checking function " << f->name() << "\n";
   }
   }
   // if f->return_term().is_auto(), the function body was already
   // if f->return_term().is_auto(), the function body was already
   // type checked in DeclareFunctionDeclaration
   // type checked in DeclareFunctionDeclaration
@@ -1546,15 +1548,15 @@ auto TypeChecker::TypeCheckFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
                          *impl_binding->type_var()->symbolic_identity(),
                          *impl_binding->type_var()->symbolic_identity(),
                          impl_binding);
                          impl_binding);
     }
     }
-    if (trace_)
-      llvm::outs() << function_scope;
+    if (trace_stream_)
+      **trace_stream_ << function_scope;
     RETURN_IF_ERROR(TypeCheckStmt(*f->body(), function_scope));
     RETURN_IF_ERROR(TypeCheckStmt(*f->body(), function_scope));
     if (!f->return_term().is_omitted()) {
     if (!f->return_term().is_omitted()) {
       RETURN_IF_ERROR(ExpectReturnOnAllPaths(f->body(), f->source_loc()));
       RETURN_IF_ERROR(ExpectReturnOnAllPaths(f->body(), f->source_loc()));
     }
     }
   }
   }
-  if (trace_) {
-    llvm::outs() << "** finished checking function " << f->name() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** finished checking function " << f->name() << "\n";
   }
   }
   return Success();
   return Success();
 }
 }
@@ -1562,8 +1564,8 @@ auto TypeChecker::TypeCheckFunctionDeclaration(Nonnull<FunctionDeclaration*> f,
 auto TypeChecker::DeclareClassDeclaration(Nonnull<ClassDeclaration*> class_decl,
 auto TypeChecker::DeclareClassDeclaration(Nonnull<ClassDeclaration*> class_decl,
                                           ImplScope& enclosing_scope)
                                           ImplScope& enclosing_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "** declaring class " << class_decl->name() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** declaring class " << class_decl->name() << "\n";
   }
   }
   if (class_decl->type_params().has_value()) {
   if (class_decl->type_params().has_value()) {
     ImplScope class_scope;
     ImplScope class_scope;
@@ -1571,8 +1573,8 @@ auto TypeChecker::DeclareClassDeclaration(Nonnull<ClassDeclaration*> class_decl,
     RETURN_IF_ERROR(TypeCheckPattern(*class_decl->type_params(), std::nullopt,
     RETURN_IF_ERROR(TypeCheckPattern(*class_decl->type_params(), std::nullopt,
                                      class_scope, ValueCategory::Let));
                                      class_scope, ValueCategory::Let));
     AddPatternImpls(*class_decl->type_params(), class_scope);
     AddPatternImpls(*class_decl->type_params(), class_scope);
-    if (trace_) {
-      llvm::outs() << class_scope;
+    if (trace_stream_) {
+      **trace_stream_ << class_scope;
     }
     }
 
 
     Nonnull<NominalClassType*> class_type =
     Nonnull<NominalClassType*> class_type =
@@ -1598,9 +1600,9 @@ auto TypeChecker::DeclareClassDeclaration(Nonnull<ClassDeclaration*> class_decl,
       RETURN_IF_ERROR(DeclareDeclaration(m, enclosing_scope));
       RETURN_IF_ERROR(DeclareDeclaration(m, enclosing_scope));
     }
     }
   }
   }
-  if (trace_) {
-    llvm::outs() << "** finished declaring class " << class_decl->name()
-                 << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** finished declaring class " << class_decl->name()
+                    << "\n";
   }
   }
   return Success();
   return Success();
 }
 }
@@ -1608,22 +1610,23 @@ auto TypeChecker::DeclareClassDeclaration(Nonnull<ClassDeclaration*> class_decl,
 auto TypeChecker::TypeCheckClassDeclaration(
 auto TypeChecker::TypeCheckClassDeclaration(
     Nonnull<ClassDeclaration*> class_decl, const ImplScope& impl_scope)
     Nonnull<ClassDeclaration*> class_decl, const ImplScope& impl_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "** checking class " << class_decl->name() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** checking class " << class_decl->name() << "\n";
   }
   }
   ImplScope class_scope;
   ImplScope class_scope;
   class_scope.AddParent(&impl_scope);
   class_scope.AddParent(&impl_scope);
   if (class_decl->type_params().has_value()) {
   if (class_decl->type_params().has_value()) {
     AddPatternImpls(*class_decl->type_params(), class_scope);
     AddPatternImpls(*class_decl->type_params(), class_scope);
   }
   }
-  if (trace_) {
-    llvm::outs() << class_scope;
+  if (trace_stream_) {
+    **trace_stream_ << class_scope;
   }
   }
   for (Nonnull<Declaration*> m : class_decl->members()) {
   for (Nonnull<Declaration*> m : class_decl->members()) {
     RETURN_IF_ERROR(TypeCheckDeclaration(m, class_scope));
     RETURN_IF_ERROR(TypeCheckDeclaration(m, class_scope));
   }
   }
-  if (trace_) {
-    llvm::outs() << "** finished checking class " << class_decl->name() << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "** finished checking class " << class_decl->name()
+                    << "\n";
   }
   }
   return Success();
   return Success();
 }
 }
@@ -1659,18 +1662,18 @@ auto TypeChecker::TypeCheckInterfaceDeclaration(
 auto TypeChecker::DeclareImplDeclaration(Nonnull<ImplDeclaration*> impl_decl,
 auto TypeChecker::DeclareImplDeclaration(Nonnull<ImplDeclaration*> impl_decl,
                                          ImplScope& enclosing_scope)
                                          ImplScope& enclosing_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "declaring " << *impl_decl << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "declaring " << *impl_decl << "\n";
   }
   }
   RETURN_IF_ERROR(TypeCheckExp(&impl_decl->interface(), enclosing_scope));
   RETURN_IF_ERROR(TypeCheckExp(&impl_decl->interface(), enclosing_scope));
   ASSIGN_OR_RETURN(Nonnull<const Value*> iface_type,
   ASSIGN_OR_RETURN(Nonnull<const Value*> iface_type,
-                   InterpExp(&impl_decl->interface(), arena_, trace_));
+                   InterpExp(&impl_decl->interface(), arena_, trace_stream_));
   const auto& iface_decl = cast<InterfaceType>(*iface_type).declaration();
   const auto& iface_decl = cast<InterfaceType>(*iface_type).declaration();
   impl_decl->set_interface_type(iface_type);
   impl_decl->set_interface_type(iface_type);
 
 
   RETURN_IF_ERROR(TypeCheckExp(impl_decl->impl_type(), enclosing_scope));
   RETURN_IF_ERROR(TypeCheckExp(impl_decl->impl_type(), enclosing_scope));
   ASSIGN_OR_RETURN(Nonnull<const Value*> impl_type_value,
   ASSIGN_OR_RETURN(Nonnull<const Value*> impl_type_value,
-                   InterpExp(impl_decl->impl_type(), arena_, trace_));
+                   InterpExp(impl_decl->impl_type(), arena_, trace_stream_));
   enclosing_scope.Add(iface_type, impl_type_value, impl_decl);
   enclosing_scope.Add(iface_type, impl_type_value, impl_decl);
 
 
   for (Nonnull<Declaration*> m : impl_decl->members()) {
   for (Nonnull<Declaration*> m : impl_decl->members()) {
@@ -1704,14 +1707,14 @@ auto TypeChecker::DeclareImplDeclaration(Nonnull<ImplDeclaration*> impl_decl,
 auto TypeChecker::TypeCheckImplDeclaration(Nonnull<ImplDeclaration*> impl_decl,
 auto TypeChecker::TypeCheckImplDeclaration(Nonnull<ImplDeclaration*> impl_decl,
                                            const ImplScope& impl_scope)
                                            const ImplScope& impl_scope)
     -> ErrorOr<Success> {
     -> ErrorOr<Success> {
-  if (trace_) {
-    llvm::outs() << "checking " << *impl_decl << "\n";
+  if (trace_stream_) {
+    **trace_stream_ << "checking " << *impl_decl << "\n";
   }
   }
   for (Nonnull<Declaration*> m : impl_decl->members()) {
   for (Nonnull<Declaration*> m : impl_decl->members()) {
     RETURN_IF_ERROR(TypeCheckDeclaration(m, impl_scope));
     RETURN_IF_ERROR(TypeCheckDeclaration(m, impl_scope));
   }
   }
-  if (trace_) {
-    llvm::outs() << "finished checking impl\n";
+  if (trace_stream_) {
+    **trace_stream_ << "finished checking impl\n";
   }
   }
   return Success();
   return Success();
 }
 }
@@ -1722,8 +1725,8 @@ auto TypeChecker::DeclareChoiceDeclaration(Nonnull<ChoiceDeclaration*> choice,
   std::vector<NamedValue> alternatives;
   std::vector<NamedValue> alternatives;
   for (Nonnull<AlternativeSignature*> alternative : choice->alternatives()) {
   for (Nonnull<AlternativeSignature*> alternative : choice->alternatives()) {
     RETURN_IF_ERROR(TypeCheckExp(&alternative->signature(), enclosing_scope));
     RETURN_IF_ERROR(TypeCheckExp(&alternative->signature(), enclosing_scope));
-    ASSIGN_OR_RETURN(auto signature,
-                     InterpExp(&alternative->signature(), arena_, trace_));
+    ASSIGN_OR_RETURN(auto signature, InterpExp(&alternative->signature(),
+                                               arena_, trace_stream_));
     alternatives.push_back({.name = alternative->name(), .value = signature});
     alternatives.push_back({.name = alternative->name(), .value = signature});
   }
   }
   auto ct = arena_->New<ChoiceType>(choice->name(), std::move(alternatives));
   auto ct = arena_->New<ChoiceType>(choice->name(), std::move(alternatives));
@@ -1849,7 +1852,7 @@ auto TypeChecker::DeclareDeclaration(Nonnull<Declaration*> d,
       RETURN_IF_ERROR(TypeCheckPattern(&var.binding(), std::nullopt,
       RETURN_IF_ERROR(TypeCheckPattern(&var.binding(), std::nullopt,
                                        enclosing_scope, var.value_category()));
                                        enclosing_scope, var.value_category()));
       ASSIGN_OR_RETURN(Nonnull<const Value*> declared_type,
       ASSIGN_OR_RETURN(Nonnull<const Value*> declared_type,
-                       InterpExp(&type, arena_, trace_));
+                       InterpExp(&type, arena_, trace_stream_));
       var.set_static_type(declared_type);
       var.set_static_type(declared_type);
       break;
       break;
     }
     }

+ 4 - 3
executable_semantics/interpreter/type_checker.h

@@ -20,8 +20,9 @@ namespace Carbon {
 
 
 class TypeChecker {
 class TypeChecker {
  public:
  public:
-  explicit TypeChecker(Nonnull<Arena*> arena, bool trace)
-      : arena_(arena), trace_(trace) {}
+  explicit TypeChecker(Nonnull<Arena*> arena,
+                       std::optional<Nonnull<llvm::raw_ostream*>> trace_stream)
+      : arena_(arena), trace_stream_(trace_stream) {}
 
 
   // Type-checks `ast` and sets properties such as `static_type`, as documented
   // Type-checks `ast` and sets properties such as `static_type`, as documented
   // on the individual nodes.
   // on the individual nodes.
@@ -176,7 +177,7 @@ class TypeChecker {
   Nonnull<Arena*> arena_;
   Nonnull<Arena*> arena_;
   std::set<ValueNodeView> constants_;
   std::set<ValueNodeView> constants_;
 
 
-  bool trace_;
+  std::optional<Nonnull<llvm::raw_ostream*>> trace_stream_;
 };
 };
 
 
 }  // namespace Carbon
 }  // namespace Carbon

+ 29 - 5
executable_semantics/main.cpp

@@ -9,6 +9,7 @@
 #include <cstdio>
 #include <cstdio>
 #include <cstring>
 #include <cstring>
 #include <iostream>
 #include <iostream>
+#include <optional>
 #include <string>
 #include <string>
 #include <vector>
 #include <vector>
 
 
@@ -20,6 +21,7 @@
 #include "executable_semantics/syntax/prelude.h"
 #include "executable_semantics/syntax/prelude.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/InitLLVM.h"
+#include "llvm/Support/raw_ostream.h"
 
 
 namespace Carbon {
 namespace Carbon {
 
 
@@ -37,23 +39,45 @@ static auto Main(llvm::StringRef default_prelude_file, int argc, char* argv[])
   // is piped to stdout.
   // is piped to stdout.
   llvm::errs().tie(&llvm::outs());
   llvm::errs().tie(&llvm::outs());
 
 
-  cl::opt<bool> trace_option("trace", cl::desc("Enable tracing"));
   cl::opt<std::string> input_file_name(cl::Positional, cl::desc("<input file>"),
   cl::opt<std::string> input_file_name(cl::Positional, cl::desc("<input file>"),
                                        cl::Required);
                                        cl::Required);
+  cl::opt<bool> parser_debug("parser_debug",
+                             cl::desc("Enable debug output from the parser"));
+  cl::opt<std::string> trace_file_name(
+      "trace_file",
+      cl::desc("Output file for tracing; set to `-` to output to stdout."));
 
 
   // Find the path of the executable if possible and use that as a relative root
   // Find the path of the executable if possible and use that as a relative root
   cl::opt<std::string> prelude_file_name("prelude", cl::desc("<prelude file>"),
   cl::opt<std::string> prelude_file_name("prelude", cl::desc("<prelude file>"),
                                          cl::init(default_prelude_file.str()));
                                          cl::init(default_prelude_file.str()));
   cl::ParseCommandLineOptions(argc, argv);
   cl::ParseCommandLineOptions(argc, argv);
 
 
+  // Set up a stream for trace output.
+  std::unique_ptr<llvm::raw_ostream> scoped_trace_stream;
+  std::optional<Nonnull<llvm::raw_ostream*>> trace_stream;
+  if (!trace_file_name.empty()) {
+    if (trace_file_name == "-") {
+      trace_stream = &llvm::outs();
+    } else {
+      std::error_code err;
+      scoped_trace_stream =
+          std::make_unique<llvm::raw_fd_ostream>(trace_file_name, err);
+      if (err) {
+        return Error(err.message());
+      }
+      trace_stream = scoped_trace_stream.get();
+    }
+  }
+
   Arena arena;
   Arena arena;
-  ASSIGN_OR_RETURN(AST ast, Parse(&arena, input_file_name, trace_option));
+  ASSIGN_OR_RETURN(AST ast, Parse(&arena, input_file_name, parser_debug));
   AddPrelude(prelude_file_name, &arena, &ast.declarations);
   AddPrelude(prelude_file_name, &arena, &ast.declarations);
 
 
   // Typecheck and run the parsed program.
   // Typecheck and run the parsed program.
-  ASSIGN_OR_RETURN(int unused_return_code,
-                   ExecProgram(&arena, ast, trace_option));
-  (void)unused_return_code;
+  ASSIGN_OR_RETURN(int return_code, ExecProgram(&arena, ast, trace_stream));
+  // Print the return code to stdout even when we aren't tracing.
+  (trace_stream ? **trace_stream : llvm::outs())
+      << "result: " << return_code << "\n";
   return Success();
   return Success();
 }
 }
 
 

+ 13 - 9
executable_semantics/syntax/parse.cpp

@@ -14,15 +14,17 @@
 
 
 namespace Carbon {
 namespace Carbon {
 
 
-auto ParseImpl(yyscan_t scanner, Nonnull<Arena*> arena,
-               std::string_view input_file_name, bool trace) -> ErrorOr<AST> {
+static auto ParseImpl(yyscan_t scanner, Nonnull<Arena*> arena,
+                      std::string_view input_file_name, bool parser_debug)
+    -> ErrorOr<AST> {
   // Prepare other parser arguments.
   // Prepare other parser arguments.
   std::optional<AST> ast = std::nullopt;
   std::optional<AST> ast = std::nullopt;
-  ParseAndLexContext context(arena->New<std::string>(input_file_name), trace);
+  ParseAndLexContext context(arena->New<std::string>(input_file_name),
+                             parser_debug);
 
 
   // Do the parse.
   // Do the parse.
   auto parser = Parser(arena, scanner, context, &ast);
   auto parser = Parser(arena, scanner, context, &ast);
-  if (trace) {
+  if (parser_debug) {
     parser.set_debug_level(1);
     parser.set_debug_level(1);
   }
   }
 
 
@@ -39,8 +41,8 @@ auto ParseImpl(yyscan_t scanner, Nonnull<Arena*> arena,
   return *ast;
   return *ast;
 }
 }
 
 
-auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name, bool trace)
-    -> ErrorOr<AST> {
+auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name,
+           bool parser_debug) -> ErrorOr<AST> {
   std::string name_str(input_file_name);
   std::string name_str(input_file_name);
   FILE* input_file = fopen(name_str.c_str(), "r");
   FILE* input_file = fopen(name_str.c_str(), "r");
   if (input_file == nullptr) {
   if (input_file == nullptr) {
@@ -54,7 +56,8 @@ auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name, bool trace)
   auto buffer = yy_create_buffer(input_file, YY_BUF_SIZE, scanner);
   auto buffer = yy_create_buffer(input_file, YY_BUF_SIZE, scanner);
   yy_switch_to_buffer(buffer, scanner);
   yy_switch_to_buffer(buffer, scanner);
 
 
-  ErrorOr<AST> result = ParseImpl(scanner, arena, input_file_name, trace);
+  ErrorOr<AST> result =
+      ParseImpl(scanner, arena, input_file_name, parser_debug);
 
 
   // Clean up the lexer.
   // Clean up the lexer.
   yy_delete_buffer(buffer, scanner);
   yy_delete_buffer(buffer, scanner);
@@ -65,7 +68,7 @@ auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name, bool trace)
 }
 }
 
 
 auto ParseFromString(Nonnull<Arena*> arena, std::string_view input_file_name,
 auto ParseFromString(Nonnull<Arena*> arena, std::string_view input_file_name,
-                     std::string_view file_contents, bool trace)
+                     std::string_view file_contents, bool parser_debug)
     -> ErrorOr<AST> {
     -> ErrorOr<AST> {
   // Prepare the lexer.
   // Prepare the lexer.
   yyscan_t scanner;
   yyscan_t scanner;
@@ -74,7 +77,8 @@ auto ParseFromString(Nonnull<Arena*> arena, std::string_view input_file_name,
       yy_scan_bytes(file_contents.data(), file_contents.size(), scanner);
       yy_scan_bytes(file_contents.data(), file_contents.size(), scanner);
   yy_switch_to_buffer(buffer, scanner);
   yy_switch_to_buffer(buffer, scanner);
 
 
-  ErrorOr<AST> result = ParseImpl(scanner, arena, input_file_name, trace);
+  ErrorOr<AST> result =
+      ParseImpl(scanner, arena, input_file_name, parser_debug);
 
 
   // Clean up the lexer.
   // Clean up the lexer.
   yy_delete_buffer(buffer, scanner);
   yy_delete_buffer(buffer, scanner);

+ 3 - 3
executable_semantics/syntax/parse.h

@@ -15,14 +15,14 @@ namespace Carbon {
 
 
 // Returns the AST representing the contents of the named file, or an error code
 // Returns the AST representing the contents of the named file, or an error code
 // if parsing fails. Allocations go into the provided arena.
 // if parsing fails. Allocations go into the provided arena.
-auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name, bool trace)
-    -> ErrorOr<Carbon::AST>;
+auto Parse(Nonnull<Arena*> arena, std::string_view input_file_name,
+           bool parser_debug) -> ErrorOr<Carbon::AST>;
 
 
 // Equivalent to `Parse`, but parses the contents of `file_contents`.
 // Equivalent to `Parse`, but parses the contents of `file_contents`.
 // `input_file_name` is used only for reporting source locations, and does
 // `input_file_name` is used only for reporting source locations, and does
 // not need to name a real file.
 // not need to name a real file.
 auto ParseFromString(Nonnull<Arena*> arena, std::string_view input_file_name,
 auto ParseFromString(Nonnull<Arena*> arena, std::string_view input_file_name,
-                     std::string_view file_contents, bool trace)
+                     std::string_view file_contents, bool parser_debug)
     -> ErrorOr<Carbon::AST>;
     -> ErrorOr<Carbon::AST>;
 
 
 }  // namespace Carbon
 }  // namespace Carbon

+ 1 - 1
executable_semantics/syntax/parse_and_lex_context.cpp

@@ -15,7 +15,7 @@ auto ParseAndLexContext::RecordSyntaxError(const std::string& message,
   // TODO: support formatting of `SourceLocation` instances with formatv().
   // TODO: support formatting of `SourceLocation` instances with formatv().
   std::string full_message;
   std::string full_message;
   llvm::raw_string_ostream(full_message)
   llvm::raw_string_ostream(full_message)
-      << (prefix_with_newline && trace() ? "\n" : "")
+      << (prefix_with_newline && parser_debug() ? "\n" : "")
       << "COMPILATION ERROR: " << source_loc() << ": " << message;
       << "COMPILATION ERROR: " << source_loc() << ": " << message;
   error_messages_.push_back(full_message);
   error_messages_.push_back(full_message);
 
 

+ 5 - 4
executable_semantics/syntax/parse_and_lex_context.h

@@ -17,8 +17,9 @@ namespace Carbon {
 class ParseAndLexContext {
 class ParseAndLexContext {
  public:
  public:
   // Creates an instance analyzing the given input file.
   // Creates an instance analyzing the given input file.
-  ParseAndLexContext(Nonnull<const std::string*> input_file_name, bool trace)
-      : input_file_name_(input_file_name), trace_(trace) {}
+  ParseAndLexContext(Nonnull<const std::string*> input_file_name,
+                     bool parser_debug)
+      : input_file_name_(input_file_name), parser_debug_(parser_debug) {}
 
 
   // Formats ands records a lexer error. Returns an error token as a
   // Formats ands records a lexer error. Returns an error token as a
   // convenience.
   // convenience.
@@ -31,7 +32,7 @@ class ParseAndLexContext {
                           static_cast<int>(current_token_position.begin.line));
                           static_cast<int>(current_token_position.begin.line));
   }
   }
 
 
-  auto trace() const -> bool { return trace_; }
+  auto parser_debug() const -> bool { return parser_debug_; }
 
 
   // The source range of the token being (or just) lex'd.
   // The source range of the token being (or just) lex'd.
   location current_token_position;
   location current_token_position;
@@ -45,7 +46,7 @@ class ParseAndLexContext {
   // when *this is called.
   // when *this is called.
   Nonnull<const std::string*> input_file_name_;
   Nonnull<const std::string*> input_file_name_;
 
 
-  bool trace_;
+  bool parser_debug_;
 
 
   std::vector<std::string> error_messages_;
   std::vector<std::string> error_messages_;
 };
 };

+ 1 - 1
executable_semantics/testdata/array/fail_index.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: RUNTIME ERROR: {{.*}}/executable_semantics/testdata/array/fail_index.carbon:16: index 2 out of range in (0, 1)
 // CHECK: RUNTIME ERROR: {{.*}}/executable_semantics/testdata/array/fail_index.carbon:16: index 2 out of range in (0, 1)

+ 1 - 1
executable_semantics/testdata/array/fail_negative_size.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/array/fail_negative_size.carbon:15: Array size cannot be negative
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/array/fail_negative_size.carbon:15: Array size cannot be negative

+ 1 - 1
executable_semantics/testdata/array/fail_size_mismatch.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/array/fail_size_mismatch.carbon:15: type error in name binding: '(i32, i32, i32)' is not implicitly convertible to '[i32; 2]'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/array/fail_size_mismatch.carbon:15: type error in name binding: '(i32, i32, i32)' is not implicitly convertible to '[i32; 2]'

+ 1 - 1
executable_semantics/testdata/array/index.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/array/nested.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/assignment_copy/destruct_original.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/assignment_copy/reassign_original.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/basic_syntax/choice.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_assign_to_function.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_assign_to_function.carbon:18: Cannot assign to rvalue 'F'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_assign_to_function.carbon:18: Cannot assign to rvalue 'F'

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_assign_to_rval.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_assign_to_rval.carbon:15: Cannot assign to rvalue '1'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_assign_to_rval.carbon:15: Cannot assign to rvalue '1'

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon:12: invalid character '\xEF' in source file.
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_char.carbon:12: invalid character '\xEF' in source file.

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_invalid_integer.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_integer.carbon:15: Invalid integer literal: 11111111111111111111111111
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_integer.carbon:15: Invalid integer literal: 11111111111111111111111111

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_invalid_var_expression.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_var_expression.carbon:14: Expected expression for variable type
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_invalid_var_expression.carbon:14: Expected expression for variable type

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_missing_var.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_missing_var.carbon:16: syntax error, unexpected COLON, expecting EQUAL or SEMICOLON
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_missing_var.carbon:16: syntax error, unexpected COLON, expecting EQUAL or SEMICOLON

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_nested_binding.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_nested_binding.carbon:15: The type of a binding pattern cannot contain bindings.
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_nested_binding.carbon:15: The type of a binding pattern cannot contain bindings.

+ 1 - 1
executable_semantics/testdata/basic_syntax/fail_unimplemented_example.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_unimplemented_example.carbon:15: Unimplemented
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/fail_unimplemented_example.carbon:15: Unimplemented

+ 1 - 1
executable_semantics/testdata/basic_syntax/next.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/basic_syntax/not_compare_precedence.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/not_compare_precedence.carbon:15: syntax error, unexpected EQUAL_EQUAL, expecting SEMICOLON
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/basic_syntax/not_compare_precedence.carbon:15: syntax error, unexpected EQUAL_EQUAL, expecting SEMICOLON

+ 1 - 1
executable_semantics/testdata/basic_syntax/placeholder_variable.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/basic_syntax/print.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: Hello world!
 // CHECK: Hello world!

+ 1 - 1
executable_semantics/testdata/basic_syntax/record.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/basic_syntax/star.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 2 - 2
executable_semantics/testdata/basic_syntax/trace.carbon

@@ -2,11 +2,11 @@
 // Exceptions. See /LICENSE for license information.
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 //
 //
 // A lot of output is elided: this is only checking for a few things for simple
 // A lot of output is elided: this is only checking for a few things for simple
-// sanity checking on --trace output.
+// sanity checking on --parser_debug --trace_file=- output.
 //
 //
 // NOAUTOUPDATE
 // NOAUTOUPDATE
 // CHECK: ********** source program **********
 // CHECK: ********** source program **********

+ 1 - 1
executable_semantics/testdata/basic_syntax/var_tuple.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/basic_syntax/zero.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/block/empty.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/block/shadowing.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/assign.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/assign_member.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/bound_method.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/class_function.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/class_function_from_instance.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/class_function_value.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/fail_field_access_mismatch.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_access_mismatch.carbon:21: class Point does not have a field named z
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_access_mismatch.carbon:21: class Point does not have a field named z

+ 1 - 1
executable_semantics/testdata/class/fail_field_mismatch.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_mismatch.carbon:20: type error in name binding: '{.x: i32, .z: i32}' is not implicitly convertible to 'class Point'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_mismatch.carbon:20: type error in name binding: '{.x: i32, .z: i32}' is not implicitly convertible to 'class Point'

+ 1 - 1
executable_semantics/testdata/class/fail_field_missing.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_missing.carbon:20: type error in name binding: '{.x: i32}' is not implicitly convertible to 'class Point'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_field_missing.carbon:20: type error in name binding: '{.x: i32}' is not implicitly convertible to 'class Point'

+ 1 - 1
executable_semantics/testdata/class/fail_method_from_class.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_method_from_class.carbon:29: GetX is not a class function
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/class/fail_method_from_class.carbon:29: GetX is not a class function

+ 1 - 1
executable_semantics/testdata/class/function_param.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/global_var.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/method.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/method_call_method.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/temp.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/class/var.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/experimental_continuation/await_maintains_scope.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 3
 // CHECK: result: 3

+ 1 - 1
executable_semantics/testdata/experimental_continuation/creation_is_noop.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/experimental_continuation/fail_continuation_syntax.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/experimental_continuation/fail_continuation_syntax.carbon:16: syntax error, unexpected identifier, expecting LEFT_CURLY_BRACE
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/experimental_continuation/fail_continuation_syntax.carbon:16: syntax error, unexpected identifier, expecting LEFT_CURLY_BRACE

+ 1 - 1
executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: RUNTIME ERROR: {{.*}}/executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon:21: undefined behavior: access to dead value 1
 // CHECK: RUNTIME ERROR: {{.*}}/executable_semantics/testdata/experimental_continuation/fail_lifetime.carbon:21: undefined behavior: access to dead value 1

+ 1 - 1
executable_semantics/testdata/experimental_continuation/recursive.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 10
 // CHECK: result: 10

+ 1 - 1
executable_semantics/testdata/experimental_continuation/run.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 1
 // CHECK: result: 1

+ 1 - 1
executable_semantics/testdata/experimental_continuation/run_with_await.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 3
 // CHECK: result: 3

+ 1 - 1
executable_semantics/testdata/experimental_continuation/shallow_copy.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 3
 // CHECK: result: 3

+ 1 - 1
executable_semantics/testdata/function/auto_return/add.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/auto_return/fail_direct_recurse.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_direct_recurse.carbon:18: Function calls itself, but has a deduced return type
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_direct_recurse.carbon:18: Function calls itself, but has a deduced return type

+ 1 - 1
executable_semantics/testdata/function/auto_return/fail_multiple_returns.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_multiple_returns.carbon:18: Only one return is allowed in a function with an `auto` return type.
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_multiple_returns.carbon:18: Only one return is allowed in a function with an `auto` return type.

+ 1 - 1
executable_semantics/testdata/function/auto_return/fail_no_return.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_no_return.carbon:15: control-flow reaches end of function that provides a `->` return type without reaching a return statement
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_no_return.carbon:15: control-flow reaches end of function that provides a `->` return type without reaching a return statement

+ 1 - 1
executable_semantics/testdata/function/auto_return/fail_separate_decl.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_separate_decl.carbon:15: Function declaration has deduced return type but no body
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/auto_return/fail_separate_decl.carbon:15: Function declaration has deduced return type but no body

+ 1 - 1
executable_semantics/testdata/function/auto_return/modify_arg_type.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/auto_return/modify_return_type.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/auto_return/type.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/empty_params.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/fail_call_with_tuple.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_call_with_tuple.carbon:19: type error in call: '((i32, i32))' is not implicitly convertible to '(i32, i32)'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_call_with_tuple.carbon:19: type error in call: '((i32, i32))' is not implicitly convertible to '(i32, i32)'

+ 1 - 1
executable_semantics/testdata/function/fail_match_no_return.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_match_no_return.carbon:17: control-flow reaches end of function that provides a `->` return type without reaching a return statement
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_match_no_return.carbon:17: control-flow reaches end of function that provides a `->` return type without reaching a return statement

+ 1 - 1
executable_semantics/testdata/function/fail_match_partial_return.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_match_partial_return.carbon:17: control-flow reaches end of function that provides a `->` return type without reaching a return statement
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_match_partial_return.carbon:17: control-flow reaches end of function that provides a `->` return type without reaching a return statement

+ 1 - 1
executable_semantics/testdata/function/fail_non_exhaustive_match.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_non_exhaustive_match.carbon:18: non-exhaustive match may allow control-flow to reach the end of a function that provides a `->` return type
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/function/fail_non_exhaustive_match.carbon:18: non-exhaustive match may allow control-flow to reach the end of a function that provides a `->` return type

+ 1 - 1
executable_semantics/testdata/function/fnty.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/ignored_parameter.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/multiple_args.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/param_lifetime.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/recursive.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/return.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/function/return_exhaustive_match.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 1
 // CHECK: result: 1

+ 1 - 1
executable_semantics/testdata/function/type_match.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/generic_class/class_function.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/generic_class/fail_argument_deduction.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_argument_deduction.carbon:28: type error in argument deduction
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_argument_deduction.carbon:28: type error in argument deduction

+ 1 - 1
executable_semantics/testdata/generic_class/fail_bad_parameter_type.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_bad_parameter_type.carbon:16: unexpected type of deduced parameter i32
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_bad_parameter_type.carbon:16: unexpected type of deduced parameter i32

+ 1 - 1
executable_semantics/testdata/generic_class/fail_field_access_on_generic.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_field_access_on_generic.carbon:15: field access, unexpected T:! Type of non-interface type Type in a.x
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_field_access_on_generic.carbon:15: field access, unexpected T:! Type of non-interface type Type in a.x

+ 1 - 1
executable_semantics/testdata/generic_class/fail_generic_in_pattern.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_generic_in_pattern.carbon:17: Generic binding may not occur in pattern with expected type: T:! i32
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_generic_in_pattern.carbon:17: Generic binding may not occur in pattern with expected type: T:! i32

+ 1 - 1
executable_semantics/testdata/generic_class/fail_instantiate_non_generic.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_instantiate_non_generic.carbon:23: attempt to instantiate a non-generic class: Point(i32)
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_instantiate_non_generic.carbon:23: attempt to instantiate a non-generic class: Point(i32)

+ 1 - 1
executable_semantics/testdata/generic_class/fail_point_equal.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_point_equal.carbon:21: type error in name binding: 'class Point(T = i32)' is not implicitly convertible to 'class Point(T = Bool)'
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_class/fail_point_equal.carbon:21: type error in name binding: 'class Point(T = i32)' is not implicitly convertible to 'class Point(T = Bool)'

+ 1 - 1
executable_semantics/testdata/generic_class/generic_class_substitution.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/generic_class/generic_fun_and_class.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/generic_class/generic_point.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/generic_class/point_with_interface.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

+ 1 - 1
executable_semantics/testdata/generic_function/apply.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: -2
 // CHECK: result: -2

+ 1 - 1
executable_semantics/testdata/generic_function/fail_not_addable.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_not_addable.carbon:17: type error in addition(1)
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_not_addable.carbon:17: type error in addition(1)

+ 1 - 1
executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon:21: type error in argument deduction
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_type_deduction_mismatch.carbon:21: type error in argument deduction

+ 1 - 1
executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN: %{not} %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{not} %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{not} %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon:20: could not deduce type argument for type parameter T
 // CHECK: COMPILATION ERROR: {{.*}}/executable_semantics/testdata/generic_function/fail_type_deduction_unused.carbon:20: could not deduce type argument for type parameter T

+ 1 - 1
executable_semantics/testdata/generic_function/non_generic_param.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 1
 // CHECK: result: 1

+ 1 - 1
executable_semantics/testdata/generic_function/return_val.carbon

@@ -4,7 +4,7 @@
 //
 //
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN: %{executable_semantics} %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
-// RUN: %{executable_semantics} --trace %s 2>&1 | \
+// RUN: %{executable_semantics} --parser_debug --trace_file=- %s 2>&1 | \
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // RUN:   %{FileCheck} --match-full-lines --allow-unused-prefixes %s
 // AUTOUPDATE: %{executable_semantics} %s
 // AUTOUPDATE: %{executable_semantics} %s
 // CHECK: result: 0
 // CHECK: result: 0

部分文件因为文件数量过多而无法显示