Migrate remaining exits to FATAL_*_ERROR calls (#704)

Adds FATAL for things that are most likely programming errors in executable_semantics.
This commit is contained in:
Jon Meow
2021-08-06 13:06:25 -07:00
committed by GitHub
parent 5749413b28
commit 2e9e4f4cb3
23 changed files with 99 additions and 150 deletions
+3 -5
View File
@@ -6,7 +6,6 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
%{
#include <cstdlib>
#include <iostream>
#include "common/check.h"
#include "executable_semantics/common/tracing_flag.h"
@@ -215,11 +214,10 @@ operator and its operand, leading to three more cases:
if (Carbon::tracing_output) {
// Print a newline because tracing prints an incomplete line
// "Reading a token: ".
std::cerr << std::endl;
llvm::errs() << "\n";
}
std::cerr << context.current_token_position << ": invalid character '\\x"
<< llvm::toHex(llvm::StringRef(yytext, 1)) << "' in source file." << std::endl;
std::exit(1);
FATAL_COMPILATION_ERROR(yylineno) << "invalid character '\\x"
<< llvm::toHex(llvm::StringRef(yytext, 1)) << "' in source file.";
}
<<EOF>> {