mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding fixes for signedness conversion warnings in libyul
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
co-authored by
Kamil Śliwak
parent
21a9d3dd21
commit
33e7b24df0
@@ -51,10 +51,10 @@ void DeadCodeEliminator::operator()(Block& _block)
|
||||
tie(controlFlowChange, index) = TerminationFinder{m_dialect}.firstUnconditionalControlFlowChange(_block.statements);
|
||||
|
||||
// Erase everything after the terminating statement that is not a function definition.
|
||||
if (controlFlowChange != TerminationFinder::ControlFlow::FlowOut && index != size_t(-1))
|
||||
if (controlFlowChange != TerminationFinder::ControlFlow::FlowOut && index != std::numeric_limits<size_t>::max())
|
||||
_block.statements.erase(
|
||||
remove_if(
|
||||
_block.statements.begin() + index + 1,
|
||||
_block.statements.begin() + static_cast<ptrdiff_t>(index) + 1,
|
||||
_block.statements.end(),
|
||||
[] (Statement const& _s) { return !holds_alternative<yul::FunctionDefinition>(_s); }
|
||||
),
|
||||
@@ -63,4 +63,3 @@ void DeadCodeEliminator::operator()(Block& _block)
|
||||
|
||||
ASTModifier::operator()(_block);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void ExpressionJoiner::decrementLatestStatementPointer()
|
||||
void ExpressionJoiner::resetLatestStatementPointer()
|
||||
{
|
||||
m_currentBlock = nullptr;
|
||||
m_latestStatementInBlock = size_t(-1);
|
||||
m_latestStatementInBlock = numeric_limits<size_t>::max();
|
||||
}
|
||||
|
||||
Statement* ExpressionJoiner::latestStatement()
|
||||
|
||||
@@ -180,7 +180,7 @@ pair<TerminationFinder::ControlFlow, size_t> TerminationFinder::firstUncondition
|
||||
if (controlFlow != ControlFlow::FlowOut)
|
||||
return {controlFlow, i};
|
||||
}
|
||||
return {ControlFlow::FlowOut, size_t(-1)};
|
||||
return {ControlFlow::FlowOut, numeric_limits<size_t>::max()};
|
||||
}
|
||||
|
||||
TerminationFinder::ControlFlow TerminationFinder::controlFlowKind(Statement const& _statement)
|
||||
|
||||
@@ -178,14 +178,14 @@ bool StackCompressor::run(
|
||||
eliminateVariables(
|
||||
_dialect,
|
||||
std::get<Block>(_object.code->statements.at(0)),
|
||||
stackSurplus.at({}),
|
||||
static_cast<size_t>(stackSurplus.at({})),
|
||||
allowMSizeOptimzation
|
||||
);
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < _object.code->statements.size(); ++i)
|
||||
{
|
||||
FunctionDefinition& fun = std::get<FunctionDefinition>(_object.code->statements[i]);
|
||||
auto& fun = std::get<FunctionDefinition>(_object.code->statements[i]);
|
||||
if (!stackSurplus.count(fun.name))
|
||||
continue;
|
||||
|
||||
@@ -193,7 +193,7 @@ bool StackCompressor::run(
|
||||
eliminateVariables(
|
||||
_dialect,
|
||||
fun,
|
||||
stackSurplus.at(fun.name),
|
||||
static_cast<size_t>(stackSurplus.at(fun.name)),
|
||||
allowMSizeOptimzation
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user