mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8870 from ethereum/fix-conflicting-symbols-in-yulopti-and-optimiser-suite
Fix conflicting symbols in yulopti and OptimiserSuite
This commit is contained in:
commit
4058ce8fe5
@ -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;
|
||||||
}
|
}
|
||||||
@ -119,7 +119,15 @@ public:
|
|||||||
|
|
||||||
for (auto const& optionAndDescription: _extraOptions)
|
for (auto const& optionAndDescription: _extraOptions)
|
||||||
{
|
{
|
||||||
yulAssert(_optimizationSteps.count(optionAndDescription.first) == 0, "");
|
yulAssert(
|
||||||
|
_optimizationSteps.count(optionAndDescription.first) == 0,
|
||||||
|
"ERROR: Conflict between yulopti controls and Yul optimizer step abbreviations.\n"
|
||||||
|
"Character '" + string(1, optionAndDescription.first) + "' is assigned to both " +
|
||||||
|
optionAndDescription.second + " and " + _optimizationSteps.at(optionAndDescription.first) + " step.\n"
|
||||||
|
"This is most likely caused by someone adding a new step abbreviation to "
|
||||||
|
"OptimiserSuite::stepNameToAbbreviationMap() and not realizing that it's used by yulopti.\n"
|
||||||
|
"Please update the code to use a different character and recompile yulopti."
|
||||||
|
);
|
||||||
printPair(optionAndDescription);
|
printPair(optionAndDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,9 +154,9 @@ public:
|
|||||||
}
|
}
|
||||||
map<char, string> const& abbreviationMap = OptimiserSuite::stepAbbreviationToNameMap();
|
map<char, string> const& abbreviationMap = OptimiserSuite::stepAbbreviationToNameMap();
|
||||||
map<char, string> const& extraOptions = {
|
map<char, string> const& extraOptions = {
|
||||||
{'q', "quit"},
|
{'#', "quit"},
|
||||||
{'l', "VarNameCleaner"},
|
{',', "VarNameCleaner"},
|
||||||
{'p', "StackCompressor"},
|
{';', "StackCompressor"},
|
||||||
};
|
};
|
||||||
|
|
||||||
printUsageBanner(abbreviationMap, extraOptions, 4);
|
printUsageBanner(abbreviationMap, extraOptions, 4);
|
||||||
@ -167,14 +175,14 @@ public:
|
|||||||
}
|
}
|
||||||
else switch (option)
|
else switch (option)
|
||||||
{
|
{
|
||||||
case 'q':
|
case '#':
|
||||||
return;
|
return;
|
||||||
case 'l':
|
case ',':
|
||||||
VarNameCleaner::run(context, *m_ast);
|
VarNameCleaner::run(context, *m_ast);
|
||||||
// VarNameCleaner destroys the unique names guarantee of the disambiguator.
|
// VarNameCleaner destroys the unique names guarantee of the disambiguator.
|
||||||
disambiguated = false;
|
disambiguated = false;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case ';':
|
||||||
{
|
{
|
||||||
Object obj;
|
Object obj;
|
||||||
obj.code = m_ast;
|
obj.code = m_ast;
|
||||||
@ -182,7 +190,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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user