yulopti: Print errors to stderr rather than stdout

This commit is contained in:
Kamil Śliwak 2020-05-07 17:16:50 +02:00
parent 3212cb6caa
commit 3e9fa7e388

View File

@ -61,7 +61,7 @@ class YulOpti
public: public:
void printErrors() void printErrors()
{ {
SourceReferenceFormatter formatter(cout); SourceReferenceFormatter formatter(cerr);
for (auto const& error: m_errors) for (auto const& error: m_errors)
formatter.printErrorInformation(*error); formatter.printErrorInformation(*error);
@ -74,7 +74,7 @@ public:
m_ast = yul::Parser(errorReporter, m_dialect).parse(scanner, false); m_ast = yul::Parser(errorReporter, m_dialect).parse(scanner, false);
if (!m_ast || !errorReporter.errors().empty()) if (!m_ast || !errorReporter.errors().empty())
{ {
cout << "Error parsing source." << endl; cerr << "Error parsing source." << endl;
printErrors(); printErrors();
return false; return false;
} }
@ -86,7 +86,7 @@ public:
); );
if (!analyzer.analyze(*m_ast) || !errorReporter.errors().empty()) if (!analyzer.analyze(*m_ast) || !errorReporter.errors().empty())
{ {
cout << "Error analyzing source." << endl; cerr << "Error analyzing source." << endl;
printErrors(); printErrors();
return false; return false;
} }
@ -182,7 +182,7 @@ public:
break; break;
} }
default: default:
cout << "Unknown option." << endl; cerr << "Unknown option." << endl;
} }
source = AsmPrinter{m_dialect}(*m_ast); source = AsmPrinter{m_dialect}(*m_ast);
} }