Просмотр исходного кода

Print the result to stdout even when trace_file is set. (#1406)

Jon Ross-Perkins 3 лет назад
Родитель
Сommit
770376bd6e
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      explorer/main.cpp

+ 6 - 3
explorer/main.cpp

@@ -77,9 +77,12 @@ static auto Main(llvm::StringRef default_prelude_file, int argc, char* argv[])
   // Typecheck and run the parsed program.
   CARBON_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";
+  // Always print the return code to stdout.
+  llvm::outs() << "result: " << return_code << "\n";
+  // When there's a dedicated trace file, print the return code to it too.
+  if (scoped_trace_stream) {
+    **trace_stream << "result: " << return_code << "\n";
+  }
   return Success();
 }