mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add std:: qualifier to move() calls
This commit is contained in:
parent
19e3c7339e
commit
f7cc29bec1
@ -52,7 +52,7 @@ AssemblyItem const& Assembly::append(AssemblyItem _i)
|
|||||||
{
|
{
|
||||||
assertThrow(m_deposit >= 0, AssemblyException, "Stack underflow.");
|
assertThrow(m_deposit >= 0, AssemblyException, "Stack underflow.");
|
||||||
m_deposit += static_cast<int>(_i.deposit());
|
m_deposit += static_cast<int>(_i.deposit());
|
||||||
m_items.emplace_back(move(_i));
|
m_items.emplace_back(std::move(_i));
|
||||||
if (!m_items.back().location().isValid() && m_currentSourceLocation.isValid())
|
if (!m_items.back().location().isValid() && m_currentSourceLocation.isValid())
|
||||||
m_items.back().setLocation(m_currentSourceLocation);
|
m_items.back().setLocation(m_currentSourceLocation);
|
||||||
m_items.back().m_modifierDepth = m_currentModifierDepth;
|
m_items.back().m_modifierDepth = m_currentModifierDepth;
|
||||||
@ -254,7 +254,7 @@ Json::Value Assembly::assemblyJSON(map<string, unsigned> const& _sourceIndices,
|
|||||||
if (!data.empty())
|
if (!data.empty())
|
||||||
jsonItem["value"] = data;
|
jsonItem["value"] = data;
|
||||||
jsonItem["source"] = sourceIndex;
|
jsonItem["source"] = sourceIndex;
|
||||||
code.append(move(jsonItem));
|
code.append(std::move(jsonItem));
|
||||||
|
|
||||||
if (item.type() == AssemblyItemType::Tag)
|
if (item.type() == AssemblyItemType::Tag)
|
||||||
{
|
{
|
||||||
@ -265,7 +265,7 @@ Json::Value Assembly::assemblyJSON(map<string, unsigned> const& _sourceIndices,
|
|||||||
jumpdest["source"] = sourceIndex;
|
jumpdest["source"] = sourceIndex;
|
||||||
if (item.m_modifierDepth != 0)
|
if (item.m_modifierDepth != 0)
|
||||||
jumpdest["modifierDepth"] = static_cast<int>(item.m_modifierDepth);
|
jumpdest["modifierDepth"] = static_cast<int>(item.m_modifierDepth);
|
||||||
code.append(move(jumpdest));
|
code.append(std::move(jumpdest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_includeSourceList)
|
if (_includeSourceList)
|
||||||
@ -464,7 +464,7 @@ map<u256, u256> const& Assembly::optimiseInternal(
|
|||||||
}
|
}
|
||||||
if (optimisedItems.size() < m_items.size())
|
if (optimisedItems.size() < m_items.size())
|
||||||
{
|
{
|
||||||
m_items = move(optimisedItems);
|
m_items = std::move(optimisedItems);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ map<u256, u256> const& Assembly::optimiseInternal(
|
|||||||
*this
|
*this
|
||||||
);
|
);
|
||||||
|
|
||||||
m_tagReplacements = move(tagReplacements);
|
m_tagReplacements = std::move(tagReplacements);
|
||||||
return *m_tagReplacements;
|
return *m_tagReplacements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ vector<AssemblyItem> CommonSubexpressionEliminator::getOptimizedItems()
|
|||||||
{
|
{
|
||||||
m_breakingItem = nullptr;
|
m_breakingItem = nullptr;
|
||||||
m_storeOperations.clear();
|
m_storeOperations.clear();
|
||||||
m_initialState = move(nextInitialState);
|
m_initialState = std::move(nextInitialState);
|
||||||
m_state = move(nextState);
|
m_state = std::move(nextState);
|
||||||
});
|
});
|
||||||
|
|
||||||
map<int, Id> initialStackContents;
|
map<int, Id> initialStackContents;
|
||||||
|
@ -244,8 +244,8 @@ AssemblyItems ComputeMethod::findRepresentation(u256 const& _value)
|
|||||||
bigint newGas = gasNeeded(newRoutine);
|
bigint newGas = gasNeeded(newRoutine);
|
||||||
if (newGas < bestGas)
|
if (newGas < bestGas)
|
||||||
{
|
{
|
||||||
bestGas = move(newGas);
|
bestGas = std::move(newGas);
|
||||||
routine = move(newRoutine);
|
routine = std::move(newRoutine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return routine;
|
return routine;
|
||||||
|
@ -236,12 +236,12 @@ void ControlFlowGraph::gatherKnowledge()
|
|||||||
item.state = _state->copy();
|
item.state = _state->copy();
|
||||||
item.blocksSeen = _currentItem.blocksSeen;
|
item.blocksSeen = _currentItem.blocksSeen;
|
||||||
item.blocksSeen.insert(_currentItem.blockId);
|
item.blocksSeen.insert(_currentItem.blockId);
|
||||||
workQueue.push_back(move(item));
|
workQueue.push_back(std::move(item));
|
||||||
};
|
};
|
||||||
|
|
||||||
while (!workQueue.empty())
|
while (!workQueue.empty())
|
||||||
{
|
{
|
||||||
WorkQueueItem item = move(workQueue.back());
|
WorkQueueItem item = std::move(workQueue.back());
|
||||||
workQueue.pop_back();
|
workQueue.pop_back();
|
||||||
//@todo we might have to do something like incrementing the sequence number for each JUMPDEST
|
//@todo we might have to do something like incrementing the sequence number for each JUMPDEST
|
||||||
assertThrow(!!item.blockId, OptimizerException, "");
|
assertThrow(!!item.blockId, OptimizerException, "");
|
||||||
|
@ -257,7 +257,7 @@ void Inliner::optimise()
|
|||||||
if (auto exitItem = shouldInline(*tag, nextItem, *inlinableBlock))
|
if (auto exitItem = shouldInline(*tag, nextItem, *inlinableBlock))
|
||||||
{
|
{
|
||||||
newItems += inlinableBlock->items | ranges::views::drop_last(1);
|
newItems += inlinableBlock->items | ranges::views::drop_last(1);
|
||||||
newItems.emplace_back(move(*exitItem));
|
newItems.emplace_back(std::move(*exitItem));
|
||||||
|
|
||||||
// We are removing one push tag to the block we inline.
|
// We are removing one push tag to the block we inline.
|
||||||
--inlinableBlock->pushTagCount;
|
--inlinableBlock->pushTagCount;
|
||||||
@ -277,5 +277,5 @@ void Inliner::optimise()
|
|||||||
newItems.emplace_back(item);
|
newItems.emplace_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_items = move(newItems);
|
m_items = std::move(newItems);
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ void KnownState::reduceToCommonKnowledge(KnownState const& _other, bool _combine
|
|||||||
map<int, Id> shiftedStack;
|
map<int, Id> shiftedStack;
|
||||||
for (auto const& stackElement: m_stackElements)
|
for (auto const& stackElement: m_stackElements)
|
||||||
shiftedStack[stackElement.first - stackDiff] = stackElement.second;
|
shiftedStack[stackElement.first - stackDiff] = stackElement.second;
|
||||||
m_stackElements = move(shiftedStack);
|
m_stackElements = std::move(shiftedStack);
|
||||||
m_stackHeight = _other.m_stackHeight;
|
m_stackHeight = _other.m_stackHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +333,7 @@ KnownState::StoreOperation KnownState::storeInStorage(
|
|||||||
for (auto const& storageItem: m_storageContent)
|
for (auto const& storageItem: m_storageContent)
|
||||||
if (m_expressionClasses->knownToBeDifferent(storageItem.first, _slot) || storageItem.second == _value)
|
if (m_expressionClasses->knownToBeDifferent(storageItem.first, _slot) || storageItem.second == _value)
|
||||||
storageContents.insert(storageItem);
|
storageContents.insert(storageItem);
|
||||||
m_storageContent = move(storageContents);
|
m_storageContent = std::move(storageContents);
|
||||||
|
|
||||||
AssemblyItem item(Instruction::SSTORE, _location);
|
AssemblyItem item(Instruction::SSTORE, _location);
|
||||||
Id id = m_expressionClasses->find(item, {_slot, _value}, true, m_sequenceNumber);
|
Id id = m_expressionClasses->find(item, {_slot, _value}, true, m_sequenceNumber);
|
||||||
@ -365,7 +365,7 @@ KnownState::StoreOperation KnownState::storeInMemory(Id _slot, Id _value, Source
|
|||||||
for (auto const& memoryItem: m_memoryContent)
|
for (auto const& memoryItem: m_memoryContent)
|
||||||
if (m_expressionClasses->knownToBeDifferentBy32(memoryItem.first, _slot))
|
if (m_expressionClasses->knownToBeDifferentBy32(memoryItem.first, _slot))
|
||||||
memoryContents.insert(memoryItem);
|
memoryContents.insert(memoryItem);
|
||||||
m_memoryContent = move(memoryContents);
|
m_memoryContent = std::move(memoryContents);
|
||||||
|
|
||||||
AssemblyItem item(Instruction::MSTORE, _location);
|
AssemblyItem item(Instruction::MSTORE, _location);
|
||||||
Id id = m_expressionClasses->find(item, {_slot, _value}, true, m_sequenceNumber);
|
Id id = m_expressionClasses->find(item, {_slot, _value}, true, m_sequenceNumber);
|
||||||
|
@ -44,7 +44,7 @@ GasMeter::GasConsumption PathGasMeter::estimateMax(
|
|||||||
auto path = make_unique<GasPath>();
|
auto path = make_unique<GasPath>();
|
||||||
path->index = _startIndex;
|
path->index = _startIndex;
|
||||||
path->state = _state->copy();
|
path->state = _state->copy();
|
||||||
queue(move(path));
|
queue(std::move(path));
|
||||||
|
|
||||||
GasMeter::GasConsumption gas;
|
GasMeter::GasConsumption gas;
|
||||||
while (!m_queue.empty() && !gas.isInfinite)
|
while (!m_queue.empty() && !gas.isInfinite)
|
||||||
@ -60,14 +60,14 @@ void PathGasMeter::queue(std::unique_ptr<GasPath>&& _newPath)
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
m_highestGasUsagePerJumpdest[_newPath->index] = _newPath->gas;
|
m_highestGasUsagePerJumpdest[_newPath->index] = _newPath->gas;
|
||||||
m_queue[_newPath->index] = move(_newPath);
|
m_queue[_newPath->index] = std::move(_newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
GasMeter::GasConsumption PathGasMeter::handleQueueItem()
|
GasMeter::GasConsumption PathGasMeter::handleQueueItem()
|
||||||
{
|
{
|
||||||
assertThrow(!m_queue.empty(), OptimizerException, "");
|
assertThrow(!m_queue.empty(), OptimizerException, "");
|
||||||
|
|
||||||
unique_ptr<GasPath> path = move(m_queue.rbegin()->second);
|
unique_ptr<GasPath> path = std::move(m_queue.rbegin()->second);
|
||||||
m_queue.erase(--m_queue.end());
|
m_queue.erase(--m_queue.end());
|
||||||
|
|
||||||
shared_ptr<KnownState> state = path->state;
|
shared_ptr<KnownState> state = path->state;
|
||||||
@ -129,7 +129,7 @@ GasMeter::GasConsumption PathGasMeter::handleQueueItem()
|
|||||||
newPath->largestMemoryAccess = meter.largestMemoryAccess();
|
newPath->largestMemoryAccess = meter.largestMemoryAccess();
|
||||||
newPath->state = state->copy();
|
newPath->state = state->copy();
|
||||||
newPath->visitedJumpdests = path->visitedJumpdests;
|
newPath->visitedJumpdests = path->visitedJumpdests;
|
||||||
queue(move(newPath));
|
queue(std::move(newPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (branchStops)
|
if (branchStops)
|
||||||
|
@ -44,7 +44,7 @@ CHCSmtLib2Interface::CHCSmtLib2Interface(
|
|||||||
):
|
):
|
||||||
CHCSolverInterface(_queryTimeout),
|
CHCSolverInterface(_queryTimeout),
|
||||||
m_smtlib2(make_unique<SMTLib2Interface>(_queryResponses, _smtCallback, m_queryTimeout)),
|
m_smtlib2(make_unique<SMTLib2Interface>(_queryResponses, _smtCallback, m_queryTimeout)),
|
||||||
m_queryResponses(move(_queryResponses)),
|
m_queryResponses(std::move(_queryResponses)),
|
||||||
m_smtCallback(_smtCallback)
|
m_smtCallback(_smtCallback)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
@ -195,7 +195,7 @@ void CHCSmtLib2Interface::declareFunction(string const& _name, SortPointer const
|
|||||||
|
|
||||||
void CHCSmtLib2Interface::write(string _data)
|
void CHCSmtLib2Interface::write(string _data)
|
||||||
{
|
{
|
||||||
m_accumulatedOutput += move(_data) + "\n";
|
m_accumulatedOutput += std::move(_data) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string CHCSmtLib2Interface::querySolver(string const& _input)
|
string CHCSmtLib2Interface::querySolver(string const& _input)
|
||||||
|
@ -45,8 +45,8 @@ SMTLib2Interface::SMTLib2Interface(
|
|||||||
optional<unsigned> _queryTimeout
|
optional<unsigned> _queryTimeout
|
||||||
):
|
):
|
||||||
SolverInterface(_queryTimeout),
|
SolverInterface(_queryTimeout),
|
||||||
m_queryResponses(move(_queryResponses)),
|
m_queryResponses(std::move(_queryResponses)),
|
||||||
m_smtCallback(move(_smtCallback))
|
m_smtCallback(std::move(_smtCallback))
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ string SMTLib2Interface::toSmtLibSort(vector<SortPointer> const& _sorts)
|
|||||||
void SMTLib2Interface::write(string _data)
|
void SMTLib2Interface::write(string _data)
|
||||||
{
|
{
|
||||||
smtAssert(!m_accumulatedOutput.empty(), "");
|
smtAssert(!m_accumulatedOutput.empty(), "");
|
||||||
m_accumulatedOutput.back() += move(_data) + "\n";
|
m_accumulatedOutput.back() += std::move(_data) + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string SMTLib2Interface::checkSatAndGetValuesCommand(vector<Expression> const& _expressionsToEvaluate)
|
string SMTLib2Interface::checkSatAndGetValuesCommand(vector<Expression> const& _expressionsToEvaluate)
|
||||||
|
@ -41,7 +41,7 @@ SMTPortfolio::SMTPortfolio(
|
|||||||
SolverInterface(_queryTimeout)
|
SolverInterface(_queryTimeout)
|
||||||
{
|
{
|
||||||
if (_enabledSolvers.smtlib2)
|
if (_enabledSolvers.smtlib2)
|
||||||
m_solvers.emplace_back(make_unique<SMTLib2Interface>(move(_smtlib2Responses), move(_smtCallback), m_queryTimeout));
|
m_solvers.emplace_back(make_unique<SMTLib2Interface>(std::move(_smtlib2Responses), std::move(_smtCallback), m_queryTimeout));
|
||||||
#ifdef HAVE_Z3
|
#ifdef HAVE_Z3
|
||||||
if (_enabledSolvers.z3 && Z3Interface::available())
|
if (_enabledSolvers.z3 && Z3Interface::available())
|
||||||
m_solvers.emplace_back(make_unique<Z3Interface>(m_queryTimeout));
|
m_solvers.emplace_back(make_unique<Z3Interface>(m_queryTimeout));
|
||||||
|
@ -101,7 +101,7 @@ tuple<CheckResult, Expression, CHCSolverInterface::CexGraph> Z3CHCInterface::que
|
|||||||
{
|
{
|
||||||
result = CheckResult::UNSATISFIABLE;
|
result = CheckResult::UNSATISFIABLE;
|
||||||
auto invariants = m_z3Interface->fromZ3Expr(m_solver.get_answer());
|
auto invariants = m_z3Interface->fromZ3Expr(m_solver.get_answer());
|
||||||
return {result, move(invariants), {}};
|
return {result, std::move(invariants), {}};
|
||||||
}
|
}
|
||||||
case z3::check_result::unknown:
|
case z3::check_result::unknown:
|
||||||
{
|
{
|
||||||
|
@ -56,7 +56,7 @@ string takeOverAllocation(char const* _data)
|
|||||||
for (auto iter = begin(solidityAllocations); iter != end(solidityAllocations); ++iter)
|
for (auto iter = begin(solidityAllocations); iter != end(solidityAllocations); ++iter)
|
||||||
if (iter->data() == _data)
|
if (iter->data() == _data)
|
||||||
{
|
{
|
||||||
string chunk = move(*iter);
|
string chunk = std::move(*iter);
|
||||||
solidityAllocations.erase(iter);
|
solidityAllocations.erase(iter);
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ ReadCallback::Callback wrapReadCallback(CStyleReadFileCallback _readCallback, vo
|
|||||||
string compile(string _input, CStyleReadFileCallback _readCallback, void* _readContext)
|
string compile(string _input, CStyleReadFileCallback _readCallback, void* _readContext)
|
||||||
{
|
{
|
||||||
StandardCompiler compiler(wrapReadCallback(_readCallback, _readContext));
|
StandardCompiler compiler(wrapReadCallback(_readCallback, _readContext));
|
||||||
return compiler.compile(move(_input));
|
return compiler.compile(std::move(_input));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ void DeclarationContainer::populateHomonyms(back_insert_iterator<Homonyms> _it)
|
|||||||
ResolvingSettings settings;
|
ResolvingSettings settings;
|
||||||
settings.recursive = true;
|
settings.recursive = true;
|
||||||
settings.alsoInvisible = true;
|
settings.alsoInvisible = true;
|
||||||
vector<Declaration const*> const& declarations = m_enclosingContainer->resolveName(name, move(settings));
|
vector<Declaration const*> const& declarations = m_enclosingContainer->resolveName(name, std::move(settings));
|
||||||
if (!declarations.empty())
|
if (!declarations.empty())
|
||||||
_it = make_pair(location, declarations);
|
_it = make_pair(location, declarations);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ CallGraph FunctionCallGraphBuilder::buildCreationGraph(ContractDefinition const&
|
|||||||
builder.m_currentNode = CallGraph::SpecialNode::Entry;
|
builder.m_currentNode = CallGraph::SpecialNode::Entry;
|
||||||
builder.processQueue();
|
builder.processQueue();
|
||||||
|
|
||||||
return move(builder.m_graph);
|
return std::move(builder.m_graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallGraph FunctionCallGraphBuilder::buildDeployedGraph(
|
CallGraph FunctionCallGraphBuilder::buildDeployedGraph(
|
||||||
@ -109,7 +109,7 @@ CallGraph FunctionCallGraphBuilder::buildDeployedGraph(
|
|||||||
builder.m_currentNode = CallGraph::SpecialNode::Entry;
|
builder.m_currentNode = CallGraph::SpecialNode::Entry;
|
||||||
builder.processQueue();
|
builder.processQueue();
|
||||||
|
|
||||||
return move(builder.m_graph);
|
return std::move(builder.m_graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionCallGraphBuilder::visit(FunctionCall const& _functionCall)
|
bool FunctionCallGraphBuilder::visit(FunctionCall const& _functionCall)
|
||||||
|
@ -184,7 +184,7 @@ vector<Declaration const*> NameAndTypeResolver::nameFromCurrentScope(ASTString c
|
|||||||
ResolvingSettings settings;
|
ResolvingSettings settings;
|
||||||
settings.recursive = true;
|
settings.recursive = true;
|
||||||
settings.alsoInvisible = _includeInvisibles;
|
settings.alsoInvisible = _includeInvisibles;
|
||||||
return m_currentScope->resolveName(_name, move(settings));
|
return m_currentScope->resolveName(_name, std::move(settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
Declaration const* NameAndTypeResolver::pathFromCurrentScope(vector<ASTString> const& _path) const
|
Declaration const* NameAndTypeResolver::pathFromCurrentScope(vector<ASTString> const& _path) const
|
||||||
@ -204,7 +204,7 @@ std::vector<Declaration const*> NameAndTypeResolver::pathFromCurrentScopeWithAll
|
|||||||
settings.recursive = true;
|
settings.recursive = true;
|
||||||
settings.alsoInvisible = false;
|
settings.alsoInvisible = false;
|
||||||
settings.onlyVisibleAsUnqualifiedNames = true;
|
settings.onlyVisibleAsUnqualifiedNames = true;
|
||||||
vector<Declaration const*> candidates = m_currentScope->resolveName(_path.front(), move(settings));
|
vector<Declaration const*> candidates = m_currentScope->resolveName(_path.front(), std::move(settings));
|
||||||
|
|
||||||
for (size_t i = 1; i < _path.size() && candidates.size() == 1; i++)
|
for (size_t i = 1; i < _path.size() && candidates.size() == 1; i++)
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ void ReferencesResolver::operator()(yul::Identifier const& _identifier)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_yulAnnotation->externalReferences[&_identifier].suffix = move(suffix);
|
m_yulAnnotation->externalReferences[&_identifier].suffix = std::move(suffix);
|
||||||
m_yulAnnotation->externalReferences[&_identifier].declaration = declarations.front();
|
m_yulAnnotation->externalReferences[&_identifier].declaration = declarations.front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1639,7 +1639,7 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
|
|||||||
if (components.size() == 1)
|
if (components.size() == 1)
|
||||||
_tuple.annotation().type = type(*components[0]);
|
_tuple.annotation().type = type(*components[0]);
|
||||||
else
|
else
|
||||||
_tuple.annotation().type = TypeProvider::tuple(move(types));
|
_tuple.annotation().type = TypeProvider::tuple(std::move(types));
|
||||||
// If some of the components are not LValues, the error is reported above.
|
// If some of the components are not LValues, the error is reported above.
|
||||||
_tuple.annotation().isLValue = true;
|
_tuple.annotation().isLValue = true;
|
||||||
_tuple.annotation().isPure = false;
|
_tuple.annotation().isPure = false;
|
||||||
@ -1710,7 +1710,7 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
|
|||||||
if (components.size() == 1)
|
if (components.size() == 1)
|
||||||
_tuple.annotation().type = type(*components[0]);
|
_tuple.annotation().type = type(*components[0]);
|
||||||
else
|
else
|
||||||
_tuple.annotation().type = TypeProvider::tuple(move(types));
|
_tuple.annotation().type = TypeProvider::tuple(std::move(types));
|
||||||
}
|
}
|
||||||
|
|
||||||
_tuple.annotation().isLValue = false;
|
_tuple.annotation().isLValue = false;
|
||||||
@ -2811,8 +2811,8 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
|
|||||||
}
|
}
|
||||||
|
|
||||||
funcCallAnno.type = returnTypes.size() == 1 ?
|
funcCallAnno.type = returnTypes.size() == 1 ?
|
||||||
move(returnTypes.front()) :
|
std::move(returnTypes.front()) :
|
||||||
TypeProvider::tuple(move(returnTypes));
|
TypeProvider::tuple(std::move(returnTypes));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ vector<ErrorDefinition const*> ContractDefinition::interfaceErrors(bool _require
|
|||||||
result +=
|
result +=
|
||||||
(*annotation().creationCallGraph)->usedErrors +
|
(*annotation().creationCallGraph)->usedErrors +
|
||||||
(*annotation().deployedCallGraph)->usedErrors;
|
(*annotation().deployedCallGraph)->usedErrors;
|
||||||
return util::convertContainer<vector<ErrorDefinition const*>>(move(result));
|
return util::convertContainer<vector<ErrorDefinition const*>>(std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<pair<util::FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList(bool _includeInheritedFunctions) const
|
vector<pair<util::FixedHash<4>, FunctionTypePointer>> const& ContractDefinition::interfaceFunctionList(bool _includeInheritedFunctions) const
|
||||||
|
@ -358,7 +358,7 @@ public:
|
|||||||
):
|
):
|
||||||
Declaration(_id, _location, _unitAlias, std::move(_unitAliasLocation)),
|
Declaration(_id, _location, _unitAlias, std::move(_unitAliasLocation)),
|
||||||
m_path(std::move(_path)),
|
m_path(std::move(_path)),
|
||||||
m_symbolAliases(move(_symbolAliases))
|
m_symbolAliases(std::move(_symbolAliases))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void accept(ASTVisitor& _visitor) override;
|
void accept(ASTVisitor& _visitor) override;
|
||||||
@ -1503,7 +1503,7 @@ public:
|
|||||||
):
|
):
|
||||||
Statement(_id, _location, _docString),
|
Statement(_id, _location, _docString),
|
||||||
m_dialect(_dialect),
|
m_dialect(_dialect),
|
||||||
m_flags(move(_flags)),
|
m_flags(std::move(_flags)),
|
||||||
m_operations(std::move(_operations))
|
m_operations(std::move(_operations))
|
||||||
{}
|
{}
|
||||||
void accept(ASTVisitor& _visitor) override;
|
void accept(ASTVisitor& _visitor) override;
|
||||||
|
@ -336,15 +336,15 @@ bool ASTJsonExporter::visit(UsingForDirective const& _node)
|
|||||||
{
|
{
|
||||||
Json::Value functionNode;
|
Json::Value functionNode;
|
||||||
functionNode["function"] = toJson(*function);
|
functionNode["function"] = toJson(*function);
|
||||||
functionList.append(move(functionNode));
|
functionList.append(std::move(functionNode));
|
||||||
}
|
}
|
||||||
attributes.emplace_back("functionList", move(functionList));
|
attributes.emplace_back("functionList", std::move(functionList));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
attributes.emplace_back("libraryName", toJson(*_node.functionsOrLibrary().front()));
|
attributes.emplace_back("libraryName", toJson(*_node.functionsOrLibrary().front()));
|
||||||
attributes.emplace_back("global", _node.global());
|
attributes.emplace_back("global", _node.global());
|
||||||
|
|
||||||
setJsonNode(_node, "UsingForDirective", move(attributes));
|
setJsonNode(_node, "UsingForDirective", std::move(attributes));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -518,7 +518,7 @@ bool ASTJsonExporter::visit(ModifierInvocation const& _node)
|
|||||||
else if (dynamic_cast<ContractDefinition const*>(declaration))
|
else if (dynamic_cast<ContractDefinition const*>(declaration))
|
||||||
attributes.emplace_back("kind", "baseConstructorSpecifier");
|
attributes.emplace_back("kind", "baseConstructorSpecifier");
|
||||||
}
|
}
|
||||||
setJsonNode(_node, "ModifierInvocation", move(attributes));
|
setJsonNode(_node, "ModifierInvocation", std::move(attributes));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,9 +645,9 @@ bool ASTJsonExporter::visit(InlineAssembly const& _node)
|
|||||||
flags.append(*flag);
|
flags.append(*flag);
|
||||||
else
|
else
|
||||||
flags.append(Json::nullValue);
|
flags.append(Json::nullValue);
|
||||||
attributes.emplace_back(make_pair("flags", move(flags)));
|
attributes.emplace_back(make_pair("flags", std::move(flags)));
|
||||||
}
|
}
|
||||||
setJsonNode(_node, "InlineAssembly", move(attributes));
|
setJsonNode(_node, "InlineAssembly", std::move(attributes));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ ASTPointer<ImportDirective> ASTJsonImporter::createImportDirective(Json::Value c
|
|||||||
path,
|
path,
|
||||||
unitAlias,
|
unitAlias,
|
||||||
createNameSourceLocation(_node),
|
createNameSourceLocation(_node),
|
||||||
move(symbolAliases)
|
std::move(symbolAliases)
|
||||||
);
|
);
|
||||||
|
|
||||||
astAssert(_node["absolutePath"].isString(), "Expected 'absolutePath' to be a string!");
|
astAssert(_node["absolutePath"].isString(), "Expected 'absolutePath' to be a string!");
|
||||||
@ -391,7 +391,7 @@ ASTPointer<UsingForDirective> ASTJsonImporter::createUsingForDirective(Json::Val
|
|||||||
|
|
||||||
return createASTNode<UsingForDirective>(
|
return createASTNode<UsingForDirective>(
|
||||||
_node,
|
_node,
|
||||||
move(functions),
|
std::move(functions),
|
||||||
!_node.isMember("libraryName"),
|
!_node.isMember("libraryName"),
|
||||||
_node["typeName"].isNull() ? nullptr : convertJsonToASTNode<TypeName>(_node["typeName"]),
|
_node["typeName"].isNull() ? nullptr : convertJsonToASTNode<TypeName>(_node["typeName"]),
|
||||||
memberAsBool(_node, "global")
|
memberAsBool(_node, "global")
|
||||||
@ -686,7 +686,7 @@ ASTPointer<InlineAssembly> ASTJsonImporter::createInlineAssembly(Json::Value con
|
|||||||
_node,
|
_node,
|
||||||
nullOrASTString(_node, "documentation"),
|
nullOrASTString(_node, "documentation"),
|
||||||
dialect,
|
dialect,
|
||||||
move(flags),
|
std::move(flags),
|
||||||
operations
|
operations
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ TupleType const* TypeProvider::tuple(vector<Type const*> members)
|
|||||||
if (members.empty())
|
if (members.empty())
|
||||||
return &m_emptyTuple;
|
return &m_emptyTuple;
|
||||||
|
|
||||||
return createAndGet<TupleType>(move(members));
|
return createAndGet<TupleType>(std::move(members));
|
||||||
}
|
}
|
||||||
|
|
||||||
ReferenceType const* TypeProvider::withLocation(ReferenceType const* _type, DataLocation _location, bool _isPointer)
|
ReferenceType const* TypeProvider::withLocation(ReferenceType const* _type, DataLocation _location, bool _isPointer)
|
||||||
|
@ -125,7 +125,7 @@ MemberList::Member::Member(Declaration const* _declaration, Type const* _type):
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
MemberList::Member::Member(Declaration const* _declaration, Type const* _type, string _name):
|
MemberList::Member::Member(Declaration const* _declaration, Type const* _type, string _name):
|
||||||
name(move(_name)),
|
name(std::move(_name)),
|
||||||
type(_type),
|
type(_type),
|
||||||
declaration(_declaration)
|
declaration(_declaration)
|
||||||
{
|
{
|
||||||
@ -305,7 +305,7 @@ MemberList const& Type::members(ASTNode const* _currentScope) const
|
|||||||
MemberList::MemberMap members = nativeMembers(_currentScope);
|
MemberList::MemberMap members = nativeMembers(_currentScope);
|
||||||
if (_currentScope)
|
if (_currentScope)
|
||||||
members += boundFunctions(*this, *_currentScope);
|
members += boundFunctions(*this, *_currentScope);
|
||||||
m_members[_currentScope] = make_unique<MemberList>(move(members));
|
m_members[_currentScope] = make_unique<MemberList>(std::move(members));
|
||||||
}
|
}
|
||||||
return *m_members[_currentScope];
|
return *m_members[_currentScope];
|
||||||
}
|
}
|
||||||
@ -2737,7 +2737,7 @@ Type const* TupleType::mobileType() const
|
|||||||
else
|
else
|
||||||
mobiles.push_back(nullptr);
|
mobiles.push_back(nullptr);
|
||||||
}
|
}
|
||||||
return TypeProvider::tuple(move(mobiles));
|
return TypeProvider::tuple(std::move(mobiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionType::FunctionType(FunctionDefinition const& _function, Kind _kind):
|
FunctionType::FunctionType(FunctionDefinition const& _function, Kind _kind):
|
||||||
|
@ -199,7 +199,7 @@ void CompilerContext::appendYulUtilityFunctions(OptimiserSettings const& _optimi
|
|||||||
if (!code.empty())
|
if (!code.empty())
|
||||||
{
|
{
|
||||||
appendInlineAssembly(
|
appendInlineAssembly(
|
||||||
yul::reindent("{\n" + move(code) + "\n}"),
|
yul::reindent("{\n" + std::move(code) + "\n}"),
|
||||||
{},
|
{},
|
||||||
m_externallyUsedYulFunctions,
|
m_externallyUsedYulFunctions,
|
||||||
true,
|
true,
|
||||||
|
@ -1293,7 +1293,7 @@ bool ContractCompiler::visit(Return const& _return)
|
|||||||
|
|
||||||
Type const* expectedType;
|
Type const* expectedType;
|
||||||
if (expression->annotation().type->category() == Type::Category::Tuple || types.size() != 1)
|
if (expression->annotation().type->category() == Type::Category::Tuple || types.size() != 1)
|
||||||
expectedType = TypeProvider::tuple(move(types));
|
expectedType = TypeProvider::tuple(std::move(types));
|
||||||
else
|
else
|
||||||
expectedType = types.front();
|
expectedType = types.front();
|
||||||
compileExpression(*expression, expectedType);
|
compileExpression(*expression, expectedType);
|
||||||
|
@ -71,7 +71,7 @@ Type const* closestType(Type const* _type, Type const* _targetType, bool _isShif
|
|||||||
solAssert(tempComponents[i], "");
|
solAssert(tempComponents[i], "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TypeProvider::tuple(move(tempComponents));
|
return TypeProvider::tuple(std::move(tempComponents));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return _targetType->dataStoredIn(DataLocation::Storage) ? _type->mobileType() : _targetType;
|
return _targetType->dataStoredIn(DataLocation::Storage) ? _type->mobileType() : _targetType;
|
||||||
@ -391,7 +391,7 @@ bool ExpressionCompiler::visit(TupleExpression const& _tuple)
|
|||||||
if (_tuple.annotation().willBeWrittenTo)
|
if (_tuple.annotation().willBeWrittenTo)
|
||||||
{
|
{
|
||||||
solAssert(!!m_currentLValue, "");
|
solAssert(!!m_currentLValue, "");
|
||||||
lvalues.push_back(move(m_currentLValue));
|
lvalues.push_back(std::move(m_currentLValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_tuple.annotation().willBeWrittenTo)
|
else if (_tuple.annotation().willBeWrittenTo)
|
||||||
@ -399,9 +399,9 @@ bool ExpressionCompiler::visit(TupleExpression const& _tuple)
|
|||||||
if (_tuple.annotation().willBeWrittenTo)
|
if (_tuple.annotation().willBeWrittenTo)
|
||||||
{
|
{
|
||||||
if (_tuple.components().size() == 1)
|
if (_tuple.components().size() == 1)
|
||||||
m_currentLValue = move(lvalues[0]);
|
m_currentLValue = std::move(lvalues[0]);
|
||||||
else
|
else
|
||||||
m_currentLValue = make_unique<TupleObject>(m_context, move(lvalues));
|
m_currentLValue = make_unique<TupleObject>(m_context, std::move(lvalues));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -151,7 +151,7 @@ void ExpressionCompiler::setLValue(Expression const& _expression, Arguments cons
|
|||||||
solAssert(!m_currentLValue, "Current LValue not reset before trying to set new one.");
|
solAssert(!m_currentLValue, "Current LValue not reset before trying to set new one.");
|
||||||
std::unique_ptr<LValueType> lvalue = std::make_unique<LValueType>(m_context, _arguments...);
|
std::unique_ptr<LValueType> lvalue = std::make_unique<LValueType>(m_context, _arguments...);
|
||||||
if (_expression.annotation().willBeWrittenTo)
|
if (_expression.annotation().willBeWrittenTo)
|
||||||
m_currentLValue = move(lvalue);
|
m_currentLValue = std::move(lvalue);
|
||||||
else
|
else
|
||||||
lvalue->retrieveValue(_expression.location(), true);
|
lvalue->retrieveValue(_expression.location(), true);
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ TupleObject::TupleObject(
|
|||||||
CompilerContext& _compilerContext,
|
CompilerContext& _compilerContext,
|
||||||
std::vector<std::unique_ptr<LValue>>&& _lvalues
|
std::vector<std::unique_ptr<LValue>>&& _lvalues
|
||||||
):
|
):
|
||||||
LValue(_compilerContext), m_lvalues(move(_lvalues))
|
LValue(_compilerContext), m_lvalues(std::move(_lvalues))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ using namespace solidity::util;
|
|||||||
|
|
||||||
string MultiUseYulFunctionCollector::requestedFunctions()
|
string MultiUseYulFunctionCollector::requestedFunctions()
|
||||||
{
|
{
|
||||||
string result = move(m_code);
|
string result = std::move(m_code);
|
||||||
m_code.clear();
|
m_code.clear();
|
||||||
m_requestedFunctions.clear();
|
m_requestedFunctions.clear();
|
||||||
return result;
|
return result;
|
||||||
@ -47,7 +47,7 @@ string MultiUseYulFunctionCollector::createFunction(string const& _name, functio
|
|||||||
string fun = _creator();
|
string fun = _creator();
|
||||||
solAssert(!fun.empty(), "");
|
solAssert(!fun.empty(), "");
|
||||||
solAssert(fun.find("function " + _name + "(") != string::npos, "Function not properly named.");
|
solAssert(fun.find("function " + _name + "(") != string::npos, "Function not properly named.");
|
||||||
m_code += move(fun);
|
m_code += std::move(fun);
|
||||||
}
|
}
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ void IRGenerationContext::addStateVariable(
|
|||||||
unsigned _byteOffset
|
unsigned _byteOffset
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_stateVariables[&_declaration] = make_pair(move(_storageOffset), _byteOffset);
|
m_stateVariables[&_declaration] = make_pair(std::move(_storageOffset), _byteOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
string IRGenerationContext::newYulVariable()
|
string IRGenerationContext::newYulVariable()
|
||||||
@ -137,12 +137,12 @@ void IRGenerationContext::initializeInternalDispatch(InternalDispatchMap _intern
|
|||||||
for (auto function: functions)
|
for (auto function: functions)
|
||||||
enqueueFunctionForCodeGeneration(*function);
|
enqueueFunctionForCodeGeneration(*function);
|
||||||
|
|
||||||
m_internalDispatchMap = move(_internalDispatch);
|
m_internalDispatchMap = std::move(_internalDispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalDispatchMap IRGenerationContext::consumeInternalDispatchMap()
|
InternalDispatchMap IRGenerationContext::consumeInternalDispatchMap()
|
||||||
{
|
{
|
||||||
InternalDispatchMap internalDispatch = move(m_internalDispatchMap);
|
InternalDispatchMap internalDispatch = std::move(m_internalDispatchMap);
|
||||||
m_internalDispatchMap.clear();
|
m_internalDispatchMap.clear();
|
||||||
return internalDispatch;
|
return internalDispatch;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ pair<string, string> IRGenerator::run(
|
|||||||
}
|
}
|
||||||
asmStack.optimize();
|
asmStack.optimize();
|
||||||
|
|
||||||
return {move(ir), asmStack.print(m_context.soliditySourceProvider())};
|
return {std::move(ir), asmStack.print(m_context.soliditySourceProvider())};
|
||||||
}
|
}
|
||||||
|
|
||||||
string IRGenerator::generate(
|
string IRGenerator::generate(
|
||||||
@ -214,7 +214,7 @@ string IRGenerator::generate(
|
|||||||
// NOTE: Function pointers can be passed from creation code via storage variables. We need to
|
// NOTE: Function pointers can be passed from creation code via storage variables. We need to
|
||||||
// get all the functions they could point to into the dispatch functions even if they're never
|
// get all the functions they could point to into the dispatch functions even if they're never
|
||||||
// referenced by name in the deployed code.
|
// referenced by name in the deployed code.
|
||||||
m_context.initializeInternalDispatch(move(internalDispatchMap));
|
m_context.initializeInternalDispatch(std::move(internalDispatchMap));
|
||||||
|
|
||||||
// Do not register immutables to avoid assignment.
|
// Do not register immutables to avoid assignment.
|
||||||
t("DeployedObject", IRNames::deployedObject(_contract));
|
t("DeployedObject", IRNames::deployedObject(_contract));
|
||||||
@ -236,8 +236,8 @@ string IRGenerator::generate(
|
|||||||
|
|
||||||
solAssert(_contract.annotation().creationCallGraph->get() != nullptr, "");
|
solAssert(_contract.annotation().creationCallGraph->get() != nullptr, "");
|
||||||
solAssert(_contract.annotation().deployedCallGraph->get() != nullptr, "");
|
solAssert(_contract.annotation().deployedCallGraph->get() != nullptr, "");
|
||||||
verifyCallGraph(collectReachableCallables(**_contract.annotation().creationCallGraph), move(creationFunctionList));
|
verifyCallGraph(collectReachableCallables(**_contract.annotation().creationCallGraph), std::move(creationFunctionList));
|
||||||
verifyCallGraph(collectReachableCallables(**_contract.annotation().deployedCallGraph), move(deployedFunctionList));
|
verifyCallGraph(collectReachableCallables(**_contract.annotation().deployedCallGraph), std::move(deployedFunctionList));
|
||||||
|
|
||||||
return t.render();
|
return t.render();
|
||||||
}
|
}
|
||||||
@ -317,7 +317,7 @@ InternalDispatchMap IRGenerator::generateInternalDispatchFunctions(ContractDefin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
templ("cases", move(cases));
|
templ("cases", std::move(cases));
|
||||||
return templ.render();
|
return templ.render();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -944,7 +944,7 @@ void IRGenerator::generateConstructors(ContractDefinition const& _contract)
|
|||||||
generateFunctionWithModifierInner(*constructor);
|
generateFunctionWithModifierInner(*constructor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t("userDefinedConstructorBody", move(body));
|
t("userDefinedConstructorBody", std::move(body));
|
||||||
|
|
||||||
return t.render();
|
return t.render();
|
||||||
});
|
});
|
||||||
@ -1117,7 +1117,7 @@ void IRGenerator::resetContext(ContractDefinition const& _contract, ExecutionCon
|
|||||||
m_context.soliditySourceProvider()
|
m_context.soliditySourceProvider()
|
||||||
);
|
);
|
||||||
newContext.copyFunctionIDsFrom(m_context);
|
newContext.copyFunctionIDsFrom(m_context);
|
||||||
m_context = move(newContext);
|
m_context = std::move(newContext);
|
||||||
|
|
||||||
m_context.setMostDerivedContract(_contract);
|
m_context.setMostDerivedContract(_contract);
|
||||||
for (auto const& var: ContractType(_contract).stateVariables())
|
for (auto const& var: ContractType(_contract).stateVariables())
|
||||||
|
@ -827,17 +827,17 @@ bool IRGeneratorForStatements::visit(BinaryOperation const& _binOp)
|
|||||||
expr = "iszero(" + expr + ")";
|
expr = "iszero(" + expr + ")";
|
||||||
}
|
}
|
||||||
else if (op == Token::Equal)
|
else if (op == Token::Equal)
|
||||||
expr = "eq(" + move(args) + ")";
|
expr = "eq(" + std::move(args) + ")";
|
||||||
else if (op == Token::NotEqual)
|
else if (op == Token::NotEqual)
|
||||||
expr = "iszero(eq(" + move(args) + "))";
|
expr = "iszero(eq(" + std::move(args) + "))";
|
||||||
else if (op == Token::GreaterThanOrEqual)
|
else if (op == Token::GreaterThanOrEqual)
|
||||||
expr = "iszero(" + string(isSigned ? "slt(" : "lt(") + move(args) + "))";
|
expr = "iszero(" + string(isSigned ? "slt(" : "lt(") + std::move(args) + "))";
|
||||||
else if (op == Token::LessThanOrEqual)
|
else if (op == Token::LessThanOrEqual)
|
||||||
expr = "iszero(" + string(isSigned ? "sgt(" : "gt(") + move(args) + "))";
|
expr = "iszero(" + string(isSigned ? "sgt(" : "gt(") + std::move(args) + "))";
|
||||||
else if (op == Token::GreaterThan)
|
else if (op == Token::GreaterThan)
|
||||||
expr = (isSigned ? "sgt(" : "gt(") + move(args) + ")";
|
expr = (isSigned ? "sgt(" : "gt(") + std::move(args) + ")";
|
||||||
else if (op == Token::LessThan)
|
else if (op == Token::LessThan)
|
||||||
expr = (isSigned ? "slt(" : "lt(") + move(args) + ")";
|
expr = (isSigned ? "slt(" : "lt(") + std::move(args) + ")";
|
||||||
else
|
else
|
||||||
solAssert(false, "Unknown comparison operator.");
|
solAssert(false, "Unknown comparison operator.");
|
||||||
define(_binOp) << expr << "\n";
|
define(_binOp) << expr << "\n";
|
||||||
@ -1109,7 +1109,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
messageArgumentType
|
messageArgumentType
|
||||||
);
|
);
|
||||||
|
|
||||||
appendCode() << move(requireOrAssertFunction) << "(" << IRVariable(*arguments[0]).name();
|
appendCode() << std::move(requireOrAssertFunction) << "(" << IRVariable(*arguments[0]).name();
|
||||||
if (messageArgumentType && messageArgumentType->sizeOnStack() > 0)
|
if (messageArgumentType && messageArgumentType->sizeOnStack() > 0)
|
||||||
appendCode() << ", " << IRVariable(*arguments[1]).commaSeparatedList();
|
appendCode() << ", " << IRVariable(*arguments[1]).commaSeparatedList();
|
||||||
appendCode() << ")\n";
|
appendCode() << ")\n";
|
||||||
|
@ -86,6 +86,6 @@ pair<bool, ArraySlicePredicate::SliceData const&> ArraySlicePredicate::create(So
|
|||||||
|
|
||||||
return {false, m_slicePredicates[tupleName] = {
|
return {false, m_slicePredicates[tupleName] = {
|
||||||
{&slice, &header, &loop},
|
{&slice, &header, &loop},
|
||||||
{move(rule1), move(rule2), move(rule3), move(rule4)}
|
{std::move(rule1), std::move(rule2), std::move(rule3), std::move(rule4)}
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void BMC::analyze(SourceUnit const& _source, map<ASTNode const*, set<Verificatio
|
|||||||
|
|
||||||
SMTEncoder::resetSourceAnalysis();
|
SMTEncoder::resetSourceAnalysis();
|
||||||
|
|
||||||
m_solvedTargets = move(_solvedTargets);
|
m_solvedTargets = std::move(_solvedTargets);
|
||||||
m_context.setSolver(m_interface.get());
|
m_context.setSolver(m_interface.get());
|
||||||
m_context.reset();
|
m_context.reset();
|
||||||
m_context.setAssertionAccumulation(true);
|
m_context.setAssertionAccumulation(true);
|
||||||
@ -686,7 +686,7 @@ pair<vector<smtutil::Expression>, vector<string>> BMC::modelExpressions()
|
|||||||
expressionName = m_charStreamProvider.charStream(*uf->location().sourceName).text(
|
expressionName = m_charStreamProvider.charStream(*uf->location().sourceName).text(
|
||||||
uf->location()
|
uf->location()
|
||||||
);
|
);
|
||||||
expressionNames.push_back(move(expressionName));
|
expressionNames.push_back(std::move(expressionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {expressionsToEvaluate, expressionNames};
|
return {expressionsToEvaluate, expressionNames};
|
||||||
@ -888,7 +888,7 @@ void BMC::addVerificationTarget(
|
|||||||
if (_type == VerificationTargetType::ConstantCondition)
|
if (_type == VerificationTargetType::ConstantCondition)
|
||||||
checkVerificationTarget(target);
|
checkVerificationTarget(target);
|
||||||
else
|
else
|
||||||
m_verificationTargets.emplace_back(move(target));
|
m_verificationTargets.emplace_back(std::move(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Solving.
|
/// Solving.
|
||||||
@ -964,7 +964,7 @@ void BMC::checkCondition(
|
|||||||
message.str(),
|
message.str(),
|
||||||
SecondarySourceLocation().append(modelMessage.str(), SourceLocation{})
|
SecondarySourceLocation().append(modelMessage.str(), SourceLocation{})
|
||||||
.append(SMTEncoder::callStackMessage(_callStack))
|
.append(SMTEncoder::callStackMessage(_callStack))
|
||||||
.append(move(secondaryLocation))
|
.append(std::move(secondaryLocation))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1422,7 +1422,7 @@ vector<smtutil::Expression> CHC::currentStateVariables(ContractDefinition const&
|
|||||||
smtutil::Expression CHC::currentEqualInitialVarsConstraints(vector<VariableDeclaration const*> const& _vars) const
|
smtutil::Expression CHC::currentEqualInitialVarsConstraints(vector<VariableDeclaration const*> const& _vars) const
|
||||||
{
|
{
|
||||||
return fold(_vars, smtutil::Expression(true), [this](auto&& _conj, auto _var) {
|
return fold(_vars, smtutil::Expression(true), [this](auto&& _conj, auto _var) {
|
||||||
return move(_conj) && currentValue(*_var) == m_context.variable(*_var)->valueAtIndex(0);
|
return std::move(_conj) && currentValue(*_var) == m_context.variable(*_var)->valueAtIndex(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1566,7 +1566,7 @@ tuple<CheckResult, smtutil::Expression, CHCSolverInterface::CexGraph> CHC::query
|
|||||||
tie(resultNoOpt, invariantNoOpt, cexNoOpt) = m_interface->query(_query);
|
tie(resultNoOpt, invariantNoOpt, cexNoOpt) = m_interface->query(_query);
|
||||||
|
|
||||||
if (resultNoOpt == CheckResult::SATISFIABLE)
|
if (resultNoOpt == CheckResult::SATISFIABLE)
|
||||||
cex = move(cexNoOpt);
|
cex = std::move(cexNoOpt);
|
||||||
|
|
||||||
spacer->setSpacerOptions(true);
|
spacer->setSpacerOptions(true);
|
||||||
}
|
}
|
||||||
@ -1817,7 +1817,7 @@ void CHC::checkAndReportTarget(
|
|||||||
predicates.insert(pred);
|
predicates.insert(pred);
|
||||||
map<Predicate const*, set<string>> invariants = collectInvariants(invariant, predicates, m_settings.invariants);
|
map<Predicate const*, set<string>> invariants = collectInvariants(invariant, predicates, m_settings.invariants);
|
||||||
for (auto pred: invariants | ranges::views::keys)
|
for (auto pred: invariants | ranges::views::keys)
|
||||||
m_invariants[pred] += move(invariants.at(pred));
|
m_invariants[pred] += std::move(invariants.at(pred));
|
||||||
}
|
}
|
||||||
else if (result == CheckResult::SATISFIABLE)
|
else if (result == CheckResult::SATISFIABLE)
|
||||||
{
|
{
|
||||||
|
@ -211,5 +211,5 @@ void EncodingContext::addAssertion(smtutil::Expression const& _expr)
|
|||||||
if (m_assertions.empty())
|
if (m_assertions.empty())
|
||||||
m_assertions.push_back(_expr);
|
m_assertions.push_back(_expr);
|
||||||
else
|
else
|
||||||
m_assertions.back() = _expr && move(m_assertions.back());
|
m_assertions.back() = _expr && std::move(m_assertions.back());
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public:
|
|||||||
smtutil::Expression newVariable(std::string _name, smtutil::SortPointer _sort)
|
smtutil::Expression newVariable(std::string _name, smtutil::SortPointer _sort)
|
||||||
{
|
{
|
||||||
solAssert(m_solver, "");
|
solAssert(m_solver, "");
|
||||||
return m_solver->newVariable(move(_name), move(_sort));
|
return m_solver->newVariable(std::move(_name), std::move(_sort));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IdCompare
|
struct IdCompare
|
||||||
|
@ -55,9 +55,9 @@ map<Predicate const*, set<string>> collectInvariants(
|
|||||||
auto arg0 = _expr->arguments.at(0);
|
auto arg0 = _expr->arguments.at(0);
|
||||||
auto arg1 = _expr->arguments.at(1);
|
auto arg1 = _expr->arguments.at(1);
|
||||||
if (starts_with(arg0.name, t))
|
if (starts_with(arg0.name, t))
|
||||||
equalities.insert({arg0.name, {arg0, move(arg1)}});
|
equalities.insert({arg0.name, {arg0, std::move(arg1)}});
|
||||||
else if (starts_with(arg1.name, t))
|
else if (starts_with(arg1.name, t))
|
||||||
equalities.insert({arg1.name, {arg1, move(arg0)}});
|
equalities.insert({arg1.name, {arg1, std::move(arg0)}});
|
||||||
}
|
}
|
||||||
for (auto const& arg: _expr->arguments)
|
for (auto const& arg: _expr->arguments)
|
||||||
_addChild(&arg);
|
_addChild(&arg);
|
||||||
|
@ -38,7 +38,7 @@ ModelChecker::ModelChecker(
|
|||||||
ReadCallback::Callback const& _smtCallback
|
ReadCallback::Callback const& _smtCallback
|
||||||
):
|
):
|
||||||
m_errorReporter(_errorReporter),
|
m_errorReporter(_errorReporter),
|
||||||
m_settings(move(_settings)),
|
m_settings(std::move(_settings)),
|
||||||
m_context(),
|
m_context(),
|
||||||
m_bmc(m_context, m_uniqueErrorReporter, _smtlib2Responses, _smtCallback, m_settings, _charStreamProvider),
|
m_bmc(m_context, m_uniqueErrorReporter, _smtlib2Responses, _smtCallback, m_settings, _charStreamProvider),
|
||||||
m_chc(m_context, m_uniqueErrorReporter, _smtlib2Responses, _smtCallback, m_settings, _charStreamProvider)
|
m_chc(m_context, m_uniqueErrorReporter, _smtlib2Responses, _smtCallback, m_settings, _charStreamProvider)
|
||||||
|
@ -50,13 +50,13 @@ Predicate const* Predicate::create(
|
|||||||
vector<ScopeOpener const*> _scopeStack
|
vector<ScopeOpener const*> _scopeStack
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
smt::SymbolicFunctionVariable predicate{_sort, move(_name), _context};
|
smt::SymbolicFunctionVariable predicate{_sort, std::move(_name), _context};
|
||||||
string functorName = predicate.currentName();
|
string functorName = predicate.currentName();
|
||||||
solAssert(!m_predicates.count(functorName), "");
|
solAssert(!m_predicates.count(functorName), "");
|
||||||
return &m_predicates.emplace(
|
return &m_predicates.emplace(
|
||||||
std::piecewise_construct,
|
std::piecewise_construct,
|
||||||
std::forward_as_tuple(functorName),
|
std::forward_as_tuple(functorName),
|
||||||
std::forward_as_tuple(move(predicate), _type, _node, _contractContext, move(_scopeStack))
|
std::forward_as_tuple(std::move(predicate), _type, _node, _contractContext, std::move(_scopeStack))
|
||||||
).first->second;
|
).first->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ Predicate::Predicate(
|
|||||||
ContractDefinition const* _contractContext,
|
ContractDefinition const* _contractContext,
|
||||||
vector<ScopeOpener const*> _scopeStack
|
vector<ScopeOpener const*> _scopeStack
|
||||||
):
|
):
|
||||||
m_predicate(move(_predicate)),
|
m_predicate(std::move(_predicate)),
|
||||||
m_type(_type),
|
m_type(_type),
|
||||||
m_node(_node),
|
m_node(_node),
|
||||||
m_contractContext(_contractContext),
|
m_contractContext(_contractContext),
|
||||||
|
@ -2977,7 +2977,7 @@ set<FunctionDefinition const*, ASTNode::CompareByID> const& SMTEncoder::contract
|
|||||||
resolvedFunctions.insert(baseFunction);
|
resolvedFunctions.insert(baseFunction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_contractFunctions.emplace(&_contract, move(resolvedFunctions));
|
m_contractFunctions.emplace(&_contract, std::move(resolvedFunctions));
|
||||||
}
|
}
|
||||||
return m_contractFunctions.at(&_contract);
|
return m_contractFunctions.at(&_contract);
|
||||||
}
|
}
|
||||||
@ -2991,7 +2991,7 @@ set<FunctionDefinition const*, ASTNode::CompareByID> const& SMTEncoder::contract
|
|||||||
for (auto const* baseFun: base->definedFunctions())
|
for (auto const* baseFun: base->definedFunctions())
|
||||||
allFunctions.insert(baseFun);
|
allFunctions.insert(baseFun);
|
||||||
|
|
||||||
m_contractFunctionsWithoutVirtual.emplace(&_contract, move(allFunctions));
|
m_contractFunctionsWithoutVirtual.emplace(&_contract, std::move(allFunctions));
|
||||||
|
|
||||||
}
|
}
|
||||||
return m_contractFunctionsWithoutVirtual.at(&_contract);
|
return m_contractFunctionsWithoutVirtual.at(&_contract);
|
||||||
|
@ -32,8 +32,8 @@ BlockchainVariable::BlockchainVariable(
|
|||||||
map<string, smtutil::SortPointer> _members,
|
map<string, smtutil::SortPointer> _members,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
m_name(move(_name)),
|
m_name(std::move(_name)),
|
||||||
m_members(move(_members)),
|
m_members(std::move(_members)),
|
||||||
m_context(_context)
|
m_context(_context)
|
||||||
{
|
{
|
||||||
vector<string> members;
|
vector<string> members;
|
||||||
@ -94,12 +94,12 @@ smtutil::Expression SymbolicState::balance() const
|
|||||||
|
|
||||||
smtutil::Expression SymbolicState::balance(smtutil::Expression _address) const
|
smtutil::Expression SymbolicState::balance(smtutil::Expression _address) const
|
||||||
{
|
{
|
||||||
return smtutil::Expression::select(balances(), move(_address));
|
return smtutil::Expression::select(balances(), std::move(_address));
|
||||||
}
|
}
|
||||||
|
|
||||||
smtutil::Expression SymbolicState::blockhash(smtutil::Expression _blockNumber) const
|
smtutil::Expression SymbolicState::blockhash(smtutil::Expression _blockNumber) const
|
||||||
{
|
{
|
||||||
return smtutil::Expression::select(m_tx.member("blockhash"), move(_blockNumber));
|
return smtutil::Expression::select(m_tx.member("blockhash"), std::move(_blockNumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SymbolicState::newBalances()
|
void SymbolicState::newBalances()
|
||||||
@ -114,13 +114,13 @@ void SymbolicState::transfer(smtutil::Expression _from, smtutil::Expression _to,
|
|||||||
{
|
{
|
||||||
unsigned indexBefore = m_state.index();
|
unsigned indexBefore = m_state.index();
|
||||||
addBalance(_from, 0 - _value);
|
addBalance(_from, 0 - _value);
|
||||||
addBalance(_to, move(_value));
|
addBalance(_to, std::move(_value));
|
||||||
unsigned indexAfter = m_state.index();
|
unsigned indexAfter = m_state.index();
|
||||||
solAssert(indexAfter > indexBefore, "");
|
solAssert(indexAfter > indexBefore, "");
|
||||||
m_state.newVar();
|
m_state.newVar();
|
||||||
/// Do not apply the transfer operation if _from == _to.
|
/// Do not apply the transfer operation if _from == _to.
|
||||||
auto newState = smtutil::Expression::ite(
|
auto newState = smtutil::Expression::ite(
|
||||||
move(_from) == move(_to),
|
std::move(_from) == std::move(_to),
|
||||||
m_state.value(indexBefore),
|
m_state.value(indexBefore),
|
||||||
m_state.value(indexAfter)
|
m_state.value(indexAfter)
|
||||||
);
|
);
|
||||||
@ -132,7 +132,7 @@ void SymbolicState::addBalance(smtutil::Expression _address, smtutil::Expression
|
|||||||
auto newBalances = smtutil::Expression::store(
|
auto newBalances = smtutil::Expression::store(
|
||||||
balances(),
|
balances(),
|
||||||
_address,
|
_address,
|
||||||
balance(_address) + move(_value)
|
balance(_address) + std::move(_value)
|
||||||
);
|
);
|
||||||
m_state.assignMember("balances", newBalances);
|
m_state.assignMember("balances", newBalances);
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ void SymbolicState::buildABIFunctions(set<FunctionCall const*> const& _abiFuncti
|
|||||||
functions[name] = functionSort;
|
functions[name] = functionSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_abi = make_unique<BlockchainVariable>("abi", move(functions), m_context);
|
m_abi = make_unique<BlockchainVariable>("abi", std::move(functions), m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
smtutil::Expression SymbolicState::abiFunction(frontend::FunctionCall const* _funCall)
|
smtutil::Expression SymbolicState::abiFunction(frontend::FunctionCall const* _funCall)
|
||||||
|
@ -38,7 +38,7 @@ SymbolicVariable::SymbolicVariable(
|
|||||||
):
|
):
|
||||||
m_type(_type),
|
m_type(_type),
|
||||||
m_originalType(_originalType),
|
m_originalType(_originalType),
|
||||||
m_uniqueName(move(_uniqueName)),
|
m_uniqueName(std::move(_uniqueName)),
|
||||||
m_context(_context),
|
m_context(_context),
|
||||||
m_ssa(make_unique<SSAVariable>())
|
m_ssa(make_unique<SSAVariable>())
|
||||||
{
|
{
|
||||||
@ -52,8 +52,8 @@ SymbolicVariable::SymbolicVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
m_sort(move(_sort)),
|
m_sort(std::move(_sort)),
|
||||||
m_uniqueName(move(_uniqueName)),
|
m_uniqueName(std::move(_uniqueName)),
|
||||||
m_context(_context),
|
m_context(_context),
|
||||||
m_ssa(make_unique<SSAVariable>())
|
m_ssa(make_unique<SSAVariable>())
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ SymbolicBoolVariable::SymbolicBoolVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _type, move(_uniqueName), _context)
|
SymbolicVariable(_type, _type, std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
solAssert(m_type->category() == frontend::Type::Category::Bool, "");
|
solAssert(m_type->category() == frontend::Type::Category::Bool, "");
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ SymbolicIntVariable::SymbolicIntVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _originalType, move(_uniqueName), _context)
|
SymbolicVariable(_type, _originalType, std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
solAssert(isNumber(*m_type), "");
|
solAssert(isNumber(*m_type), "");
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ SymbolicAddressVariable::SymbolicAddressVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicIntVariable(TypeProvider::uint(160), TypeProvider::uint(160), move(_uniqueName), _context)
|
SymbolicIntVariable(TypeProvider::uint(160), TypeProvider::uint(160), std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ SymbolicFixedBytesVariable::SymbolicFixedBytesVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicIntVariable(TypeProvider::uint(_numBytes * 8), _originalType, move(_uniqueName), _context)
|
SymbolicIntVariable(TypeProvider::uint(_numBytes * 8), _originalType, std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ SymbolicFunctionVariable::SymbolicFunctionVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _type, move(_uniqueName), _context),
|
SymbolicVariable(_type, _type, std::move(_uniqueName), _context),
|
||||||
m_declaration(m_context.newVariable(currentName(), m_sort))
|
m_declaration(m_context.newVariable(currentName(), m_sort))
|
||||||
{
|
{
|
||||||
solAssert(m_type->category() == frontend::Type::Category::Function, "");
|
solAssert(m_type->category() == frontend::Type::Category::Function, "");
|
||||||
@ -158,7 +158,7 @@ SymbolicFunctionVariable::SymbolicFunctionVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(move(_sort), move(_uniqueName), _context),
|
SymbolicVariable(std::move(_sort), std::move(_uniqueName), _context),
|
||||||
m_declaration(m_context.newVariable(currentName(), m_sort))
|
m_declaration(m_context.newVariable(currentName(), m_sort))
|
||||||
{
|
{
|
||||||
solAssert(m_sort->kind == Kind::Function, "");
|
solAssert(m_sort->kind == Kind::Function, "");
|
||||||
@ -219,7 +219,7 @@ SymbolicEnumVariable::SymbolicEnumVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _type, move(_uniqueName), _context)
|
SymbolicVariable(_type, _type, std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
solAssert(isEnum(*m_type), "");
|
solAssert(isEnum(*m_type), "");
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ SymbolicTupleVariable::SymbolicTupleVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _type, move(_uniqueName), _context)
|
SymbolicVariable(_type, _type, std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
solAssert(isTuple(*m_type), "");
|
solAssert(isTuple(*m_type), "");
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ SymbolicTupleVariable::SymbolicTupleVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(move(_sort), move(_uniqueName), _context)
|
SymbolicVariable(std::move(_sort), std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
solAssert(m_sort->kind == Kind::Tuple, "");
|
solAssert(m_sort->kind == Kind::Tuple, "");
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ SymbolicArrayVariable::SymbolicArrayVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _originalType, move(_uniqueName), _context),
|
SymbolicVariable(_type, _originalType, std::move(_uniqueName), _context),
|
||||||
m_pair(
|
m_pair(
|
||||||
smtSort(*_type),
|
smtSort(*_type),
|
||||||
m_uniqueName + "_length_pair",
|
m_uniqueName + "_length_pair",
|
||||||
@ -303,7 +303,7 @@ SymbolicArrayVariable::SymbolicArrayVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(move(_sort), move(_uniqueName), _context),
|
SymbolicVariable(std::move(_sort), std::move(_uniqueName), _context),
|
||||||
m_pair(
|
m_pair(
|
||||||
std::make_shared<TupleSort>(
|
std::make_shared<TupleSort>(
|
||||||
"array_length_pair",
|
"array_length_pair",
|
||||||
@ -346,7 +346,7 @@ SymbolicStructVariable::SymbolicStructVariable(
|
|||||||
string _uniqueName,
|
string _uniqueName,
|
||||||
EncodingContext& _context
|
EncodingContext& _context
|
||||||
):
|
):
|
||||||
SymbolicVariable(_type, _type, move(_uniqueName), _context)
|
SymbolicVariable(_type, _type, std::move(_uniqueName), _context)
|
||||||
{
|
{
|
||||||
solAssert(isNonRecursiveStruct(*m_type), "");
|
solAssert(isNonRecursiveStruct(*m_type), "");
|
||||||
auto const* structType = dynamic_cast<StructType const*>(_type);
|
auto const* structType = dynamic_cast<StructType const*>(_type);
|
||||||
|
@ -134,7 +134,7 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
|
|||||||
formatType(p->name(), *type, *p->annotation().type, false)
|
formatType(p->name(), *type, *p->annotation().type, false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
abi.emplace(move(errorJson));
|
abi.emplace(std::move(errorJson));
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value abiJson{Json::arrayValue};
|
Json::Value abiJson{Json::arrayValue};
|
||||||
|
@ -208,7 +208,7 @@ void CompilerStack::setRemappings(vector<ImportRemapper::Remapping> _remappings)
|
|||||||
solThrow(CompilerError, "Must set remappings before parsing.");
|
solThrow(CompilerError, "Must set remappings before parsing.");
|
||||||
for (auto const& remapping: _remappings)
|
for (auto const& remapping: _remappings)
|
||||||
solAssert(!remapping.prefix.empty(), "");
|
solAssert(!remapping.prefix.empty(), "");
|
||||||
m_importRemapper.setRemappings(move(_remappings));
|
m_importRemapper.setRemappings(std::move(_remappings));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerStack::setViaIR(bool _viaIR)
|
void CompilerStack::setViaIR(bool _viaIR)
|
||||||
@ -407,7 +407,7 @@ void CompilerStack::importASTs(map<string, Json::Value> const& _sources)
|
|||||||
src.first,
|
src.first,
|
||||||
true // imported from AST
|
true // imported from AST
|
||||||
);
|
);
|
||||||
m_sources[path] = move(source);
|
m_sources[path] = std::move(source);
|
||||||
}
|
}
|
||||||
m_stackState = ParsedAndImported;
|
m_stackState = ParsedAndImported;
|
||||||
m_importedSources = true;
|
m_importedSources = true;
|
||||||
@ -793,7 +793,7 @@ Json::Value CompilerStack::generatedSources(string const& _contractName, bool _r
|
|||||||
sources[0]["name"] = sourceName;
|
sources[0]["name"] = sourceName;
|
||||||
sources[0]["id"] = sourceIndex;
|
sources[0]["id"] = sourceIndex;
|
||||||
sources[0]["language"] = "Yul";
|
sources[0]["language"] = "Yul";
|
||||||
sources[0]["contents"] = move(source);
|
sources[0]["contents"] = std::move(source);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ void ImportRemapper::setRemappings(vector<Remapping> _remappings)
|
|||||||
{
|
{
|
||||||
for (auto const& remapping: _remappings)
|
for (auto const& remapping: _remappings)
|
||||||
solAssert(!remapping.prefix.empty(), "");
|
solAssert(!remapping.prefix.empty(), "");
|
||||||
m_remappings = move(_remappings);
|
m_remappings = std::move(_remappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceUnitName ImportRemapper::apply(ImportPath const& _path, string const& _context) const
|
SourceUnitName ImportRemapper::apply(ImportPath const& _path, string const& _context) const
|
||||||
|
@ -92,7 +92,7 @@ Json::Value Natspec::userDocumentation(ContractDefinition const& _contractDef)
|
|||||||
{
|
{
|
||||||
Json::Value errorDoc{Json::objectValue};
|
Json::Value errorDoc{Json::objectValue};
|
||||||
errorDoc["notice"] = value;
|
errorDoc["notice"] = value;
|
||||||
doc["errors"][error->functionType(true)->externalSignature()].append(move(errorDoc));
|
doc["errors"][error->functionType(true)->externalSignature()].append(std::move(errorDoc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,10 +140,10 @@ Json::Value Natspec::devDocumentation(ContractDefinition const& _contractDef)
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!jsonReturn.empty())
|
if (!jsonReturn.empty())
|
||||||
method["returns"] = move(jsonReturn);
|
method["returns"] = std::move(jsonReturn);
|
||||||
|
|
||||||
if (!method.empty())
|
if (!method.empty())
|
||||||
doc["methods"][it.second->externalSignature()] = move(method);
|
doc["methods"][it.second->externalSignature()] = std::move(method);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ Json::Value Natspec::extractCustomDoc(multimap<string, DocTag> const& _tags)
|
|||||||
return Json::nullValue;
|
return Json::nullValue;
|
||||||
Json::Value result{Json::objectValue};
|
Json::Value result{Json::objectValue};
|
||||||
for (auto& [tag, value]: concatenated)
|
for (auto& [tag, value]: concatenated)
|
||||||
result[tag] = move(value);
|
result[tag] = std::move(value);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ Json::Value collectEVMObject(
|
|||||||
if (_runtimeObject && _artifactRequested("immutableReferences"))
|
if (_runtimeObject && _artifactRequested("immutableReferences"))
|
||||||
output["immutableReferences"] = formatImmutableReferences(_object.immutableReferences);
|
output["immutableReferences"] = formatImmutableReferences(_object.immutableReferences);
|
||||||
if (_artifactRequested("generatedSources"))
|
if (_artifactRequested("generatedSources"))
|
||||||
output["generatedSources"] = move(_generatedSources);
|
output["generatedSources"] = std::move(_generatedSources);
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -966,7 +966,7 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
|
|||||||
if (sourceContracts[source].empty())
|
if (sourceContracts[source].empty())
|
||||||
return formatFatalError("JSONError", "Source contracts must be a non-empty array.");
|
return formatFatalError("JSONError", "Source contracts must be a non-empty array.");
|
||||||
}
|
}
|
||||||
ret.modelCheckerSettings.contracts = {move(sourceContracts)};
|
ret.modelCheckerSettings.contracts = {std::move(sourceContracts)};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modelCheckerSettings.isMember("divModNoSlacks"))
|
if (modelCheckerSettings.isMember("divModNoSlacks"))
|
||||||
@ -1076,7 +1076,7 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
|
|||||||
compilerStack.setViaIR(_inputsAndSettings.viaIR);
|
compilerStack.setViaIR(_inputsAndSettings.viaIR);
|
||||||
compilerStack.setEVMVersion(_inputsAndSettings.evmVersion);
|
compilerStack.setEVMVersion(_inputsAndSettings.evmVersion);
|
||||||
compilerStack.setParserErrorRecovery(_inputsAndSettings.parserErrorRecovery);
|
compilerStack.setParserErrorRecovery(_inputsAndSettings.parserErrorRecovery);
|
||||||
compilerStack.setRemappings(move(_inputsAndSettings.remappings));
|
compilerStack.setRemappings(std::move(_inputsAndSettings.remappings));
|
||||||
compilerStack.setOptimiserSettings(std::move(_inputsAndSettings.optimiserSettings));
|
compilerStack.setOptimiserSettings(std::move(_inputsAndSettings.optimiserSettings));
|
||||||
compilerStack.setRevertStringBehaviour(_inputsAndSettings.revertStrings);
|
compilerStack.setRevertStringBehaviour(_inputsAndSettings.revertStrings);
|
||||||
if (_inputsAndSettings.debugInfoSelection.has_value())
|
if (_inputsAndSettings.debugInfoSelection.has_value())
|
||||||
@ -1582,7 +1582,7 @@ Json::Value StandardCompiler::formatFunctionDebugData(
|
|||||||
fun["entryPoint"] = Json::nullValue;
|
fun["entryPoint"] = Json::nullValue;
|
||||||
fun["parameterSlots"] = Json::UInt64(info.params);
|
fun["parameterSlots"] = Json::UInt64(info.params);
|
||||||
fun["returnSlots"] = Json::UInt64(info.returns);
|
fun["returnSlots"] = Json::UInt64(info.returns);
|
||||||
ret[name] = move(fun);
|
ret[name] = std::move(fun);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -40,8 +40,8 @@ Json::Value StorageLayout::generate(ContractDefinition const& _contractDef)
|
|||||||
variables.append(generate(*var, slot, offset));
|
variables.append(generate(*var, slot, offset));
|
||||||
|
|
||||||
Json::Value layout;
|
Json::Value layout;
|
||||||
layout["storage"] = move(variables);
|
layout["storage"] = std::move(variables);
|
||||||
layout["types"] = move(m_types);
|
layout["types"] = std::move(m_types);
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ void StorageLayout::generate(Type const* _type)
|
|||||||
auto const& offsets = structType->storageOffsetsOfMember(member->name());
|
auto const& offsets = structType->storageOffsetsOfMember(member->name());
|
||||||
members.append(generate(*member, offsets.first, offsets.second));
|
members.append(generate(*member, offsets.first, offsets.second));
|
||||||
}
|
}
|
||||||
typeInfo["members"] = move(members);
|
typeInfo["members"] = std::move(members);
|
||||||
typeInfo["encoding"] = "inplace";
|
typeInfo["encoding"] = "inplace";
|
||||||
}
|
}
|
||||||
else if (auto mappingType = dynamic_cast<MappingType const*>(_type))
|
else if (auto mappingType = dynamic_cast<MappingType const*>(_type))
|
||||||
|
@ -62,7 +62,7 @@ string FileRepository::sourceUnitNameToUri(string const& _sourceUnitName) const
|
|||||||
if (!regex_search(inputPath, windowsDriveLetterPath))
|
if (!regex_search(inputPath, windowsDriveLetterPath))
|
||||||
return inputPath;
|
return inputPath;
|
||||||
else
|
else
|
||||||
return "/" + move(inputPath);
|
return "/" + std::move(inputPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m_sourceUnitNamesToUri.count(_sourceUnitName))
|
if (m_sourceUnitNamesToUri.count(_sourceUnitName))
|
||||||
@ -124,7 +124,7 @@ Result<boost::filesystem::path> FileRepository::tryResolvePath(std::string const
|
|||||||
boost::filesystem::path canonicalPath = boost::filesystem::path(prefix) / boost::filesystem::path(_strippedSourceUnitName);
|
boost::filesystem::path canonicalPath = boost::filesystem::path(prefix) / boost::filesystem::path(_strippedSourceUnitName);
|
||||||
|
|
||||||
if (boost::filesystem::exists(canonicalPath))
|
if (boost::filesystem::exists(canonicalPath))
|
||||||
candidates.push_back(move(canonicalPath));
|
candidates.push_back(std::move(canonicalPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidates.empty())
|
if (candidates.empty())
|
||||||
@ -169,7 +169,7 @@ frontend::ReadCallback::Result FileRepository::readFile(string const& _kind, str
|
|||||||
auto contents = readFileAsString(resolvedPath.get());
|
auto contents = readFileAsString(resolvedPath.get());
|
||||||
solAssert(m_sourceCodes.count(_sourceUnitName) == 0, "");
|
solAssert(m_sourceCodes.count(_sourceUnitName) == 0, "");
|
||||||
m_sourceCodes[_sourceUnitName] = contents;
|
m_sourceCodes[_sourceUnitName] = contents;
|
||||||
return ReadCallback::Result{true, move(contents)};
|
return ReadCallback::Result{true, std::move(contents)};
|
||||||
}
|
}
|
||||||
catch (std::exception const& _exception)
|
catch (std::exception const& _exception)
|
||||||
{
|
{
|
||||||
|
@ -44,13 +44,13 @@ void GotoDefinition::operator()(MessageID _id, Json::Value const& _args)
|
|||||||
// Handles all expressions that can have one or more declaration annotation.
|
// Handles all expressions that can have one or more declaration annotation.
|
||||||
if (auto const* declaration = referencedDeclaration(expression))
|
if (auto const* declaration = referencedDeclaration(expression))
|
||||||
if (auto location = declarationLocation(declaration))
|
if (auto location = declarationLocation(declaration))
|
||||||
locations.emplace_back(move(location.value()));
|
locations.emplace_back(std::move(location.value()));
|
||||||
}
|
}
|
||||||
else if (auto const* identifierPath = dynamic_cast<IdentifierPath const*>(sourceNode))
|
else if (auto const* identifierPath = dynamic_cast<IdentifierPath const*>(sourceNode))
|
||||||
{
|
{
|
||||||
if (auto const* declaration = identifierPath->annotation().referencedDeclaration)
|
if (auto const* declaration = identifierPath->annotation().referencedDeclaration)
|
||||||
if (auto location = declarationLocation(declaration))
|
if (auto location = declarationLocation(declaration))
|
||||||
locations.emplace_back(move(location.value()));
|
locations.emplace_back(std::move(location.value()));
|
||||||
}
|
}
|
||||||
else if (auto const* importDirective = dynamic_cast<ImportDirective const*>(sourceNode))
|
else if (auto const* importDirective = dynamic_cast<ImportDirective const*>(sourceNode))
|
||||||
{
|
{
|
||||||
|
@ -202,7 +202,7 @@ void LanguageServer::changeConfiguration(Json::Value const& _settings)
|
|||||||
else
|
else
|
||||||
typeFailureCount++;
|
typeFailureCount++;
|
||||||
}
|
}
|
||||||
m_fileRepository.setIncludePaths(move(includePaths));
|
m_fileRepository.setIncludePaths(std::move(includePaths));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++typeFailureCount;
|
++typeFailureCount;
|
||||||
@ -289,7 +289,7 @@ void LanguageServer::compileAndUpdateDiagnostics()
|
|||||||
string message = error->typeName() + ":";
|
string message = error->typeName() + ":";
|
||||||
if (string const* comment = error->comment())
|
if (string const* comment = error->comment())
|
||||||
message += " " + *comment;
|
message += " " + *comment;
|
||||||
jsonDiag["message"] = move(message);
|
jsonDiag["message"] = std::move(message);
|
||||||
jsonDiag["range"] = toRange(*location);
|
jsonDiag["range"] = toRange(*location);
|
||||||
|
|
||||||
if (auto const* secondary = error->secondarySourceLocation())
|
if (auto const* secondary = error->secondarySourceLocation())
|
||||||
@ -318,8 +318,8 @@ void LanguageServer::compileAndUpdateDiagnostics()
|
|||||||
params["uri"] = m_fileRepository.sourceUnitNameToUri(sourceUnitName);
|
params["uri"] = m_fileRepository.sourceUnitNameToUri(sourceUnitName);
|
||||||
if (!diagnostics.empty())
|
if (!diagnostics.empty())
|
||||||
m_nonemptyDiagnostics.insert(sourceUnitName);
|
m_nonemptyDiagnostics.insert(sourceUnitName);
|
||||||
params["diagnostics"] = move(diagnostics);
|
params["diagnostics"] = std::move(diagnostics);
|
||||||
m_client.notify("textDocument/publishDiagnostics", move(params));
|
m_client.notify("textDocument/publishDiagnostics", std::move(params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +418,7 @@ void LanguageServer::handleInitialize(MessageID _id, Json::Value const& _args)
|
|||||||
replyArgs["capabilities"]["semanticTokensProvider"]["full"] = true; // XOR requests.full.delta = true
|
replyArgs["capabilities"]["semanticTokensProvider"]["full"] = true; // XOR requests.full.delta = true
|
||||||
replyArgs["capabilities"]["renameProvider"] = true;
|
replyArgs["capabilities"]["renameProvider"] = true;
|
||||||
|
|
||||||
m_client.reply(_id, move(replyArgs));
|
m_client.reply(_id, std::move(replyArgs));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanguageServer::handleInitialized(MessageID, Json::Value const&)
|
void LanguageServer::handleInitialized(MessageID, Json::Value const&)
|
||||||
@ -480,7 +480,7 @@ void LanguageServer::handleTextDocumentDidOpen(Json::Value const& _args)
|
|||||||
string text = _args["textDocument"]["text"].asString();
|
string text = _args["textDocument"]["text"].asString();
|
||||||
string uri = _args["textDocument"]["uri"].asString();
|
string uri = _args["textDocument"]["uri"].asString();
|
||||||
m_openFiles.insert(uri);
|
m_openFiles.insert(uri);
|
||||||
m_fileRepository.setSourceByUri(uri, move(text));
|
m_fileRepository.setSourceByUri(uri, std::move(text));
|
||||||
compileAndUpdateDiagnostics();
|
compileAndUpdateDiagnostics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -516,10 +516,10 @@ void LanguageServer::handleTextDocumentDidChange(Json::Value const& _args)
|
|||||||
);
|
);
|
||||||
|
|
||||||
string buffer = m_fileRepository.sourceUnits().at(sourceUnitName);
|
string buffer = m_fileRepository.sourceUnits().at(sourceUnitName);
|
||||||
buffer.replace(static_cast<size_t>(change->start), static_cast<size_t>(change->end - change->start), move(text));
|
buffer.replace(static_cast<size_t>(change->start), static_cast<size_t>(change->end - change->start), std::move(text));
|
||||||
text = move(buffer);
|
text = std::move(buffer);
|
||||||
}
|
}
|
||||||
m_fileRepository.setSourceByUri(uri, move(text));
|
m_fileRepository.setSourceByUri(uri, std::move(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
compileAndUpdateDiagnostics();
|
compileAndUpdateDiagnostics();
|
||||||
|
@ -67,7 +67,7 @@ optional<Json::Value> Transport::receive()
|
|||||||
return nullopt;
|
return nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {move(jsonMessage)};
|
return {std::move(jsonMessage)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transport::trace(std::string _message, Json::Value _extra)
|
void Transport::trace(std::string _message, Json::Value _extra)
|
||||||
@ -76,9 +76,9 @@ void Transport::trace(std::string _message, Json::Value _extra)
|
|||||||
{
|
{
|
||||||
Json::Value params;
|
Json::Value params;
|
||||||
if (_extra.isObject())
|
if (_extra.isObject())
|
||||||
params = move(_extra);
|
params = std::move(_extra);
|
||||||
params["message"] = move(_message);
|
params["message"] = std::move(_message);
|
||||||
notify("$/logTrace", move(params));
|
notify("$/logTrace", std::move(params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,30 +101,30 @@ optional<map<string, string>> Transport::parseHeaders()
|
|||||||
if (!headers.emplace(boost::trim_copy(name), boost::trim_copy(value)).second)
|
if (!headers.emplace(boost::trim_copy(name), boost::trim_copy(value)).second)
|
||||||
return nullopt;
|
return nullopt;
|
||||||
}
|
}
|
||||||
return {move(headers)};
|
return {std::move(headers)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transport::notify(string _method, Json::Value _message)
|
void Transport::notify(string _method, Json::Value _message)
|
||||||
{
|
{
|
||||||
Json::Value json;
|
Json::Value json;
|
||||||
json["method"] = move(_method);
|
json["method"] = std::move(_method);
|
||||||
json["params"] = move(_message);
|
json["params"] = std::move(_message);
|
||||||
send(move(json));
|
send(std::move(json));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transport::reply(MessageID _id, Json::Value _message)
|
void Transport::reply(MessageID _id, Json::Value _message)
|
||||||
{
|
{
|
||||||
Json::Value json;
|
Json::Value json;
|
||||||
json["result"] = move(_message);
|
json["result"] = std::move(_message);
|
||||||
send(move(json), _id);
|
send(std::move(json), _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transport::error(MessageID _id, ErrorCode _code, string _message)
|
void Transport::error(MessageID _id, ErrorCode _code, string _message)
|
||||||
{
|
{
|
||||||
Json::Value json;
|
Json::Value json;
|
||||||
json["error"]["code"] = static_cast<int>(_code);
|
json["error"]["code"] = static_cast<int>(_code);
|
||||||
json["error"]["message"] = move(_message);
|
json["error"]["message"] = std::move(_message);
|
||||||
send(move(json), _id);
|
send(std::move(json), _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transport::send(Json::Value _json, MessageID _id)
|
void Transport::send(Json::Value _json, MessageID _id)
|
||||||
|
@ -116,7 +116,7 @@ multimap<string, DocTag> DocStringParser::parse()
|
|||||||
currPos = nlPos + 1;
|
currPos = nlPos + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return move(m_docTags);
|
return std::move(m_docTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
DocStringParser::iter DocStringParser::parseDocTagLine(iter _pos, iter _end, bool _appending)
|
DocStringParser::iter DocStringParser::parseDocTagLine(iter _pos, iter _end, bool _appending)
|
||||||
|
@ -274,7 +274,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective()
|
|||||||
expectToken(Token::As);
|
expectToken(Token::As);
|
||||||
tie(alias, aliasLocation) = expectIdentifierWithLocation();
|
tie(alias, aliasLocation) = expectIdentifierWithLocation();
|
||||||
}
|
}
|
||||||
symbolAliases.emplace_back(ImportDirective::SymbolAlias{move(id), move(alias), aliasLocation});
|
symbolAliases.emplace_back(ImportDirective::SymbolAlias{std::move(id), std::move(alias), aliasLocation});
|
||||||
if (m_scanner->currentToken() != Token::Comma)
|
if (m_scanner->currentToken() != Token::Comma)
|
||||||
break;
|
break;
|
||||||
advance();
|
advance();
|
||||||
@ -302,7 +302,7 @@ ASTPointer<ImportDirective> Parser::parseImportDirective()
|
|||||||
fatalParserError(6326_error, "Import path cannot be empty.");
|
fatalParserError(6326_error, "Import path cannot be empty.");
|
||||||
nodeFactory.markEndPosition();
|
nodeFactory.markEndPosition();
|
||||||
expectToken(Token::Semicolon);
|
expectToken(Token::Semicolon);
|
||||||
return nodeFactory.createNode<ImportDirective>(path, unitAlias, unitAliasLocation, move(symbolAliases));
|
return nodeFactory.createNode<ImportDirective>(path, unitAlias, unitAliasLocation, std::move(symbolAliases));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<ContractKind, bool> Parser::parseContractKind()
|
std::pair<ContractKind, bool> Parser::parseContractKind()
|
||||||
@ -496,7 +496,7 @@ ASTPointer<OverrideSpecifier> Parser::parseOverrideSpecifier()
|
|||||||
expectToken(Token::RParen);
|
expectToken(Token::RParen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeFactory.createNode<OverrideSpecifier>(move(overrides));
|
return nodeFactory.createNode<OverrideSpecifier>(std::move(overrides));
|
||||||
}
|
}
|
||||||
|
|
||||||
StateMutability Parser::parseStateMutability()
|
StateMutability Parser::parseStateMutability()
|
||||||
@ -686,7 +686,7 @@ ASTPointer<StructDefinition> Parser::parseStructDefinition()
|
|||||||
}
|
}
|
||||||
nodeFactory.markEndPosition();
|
nodeFactory.markEndPosition();
|
||||||
expectToken(Token::RBrace);
|
expectToken(Token::RBrace);
|
||||||
return nodeFactory.createNode<StructDefinition>(move(name), move(nameLocation), move(members));
|
return nodeFactory.createNode<StructDefinition>(std::move(name), std::move(nameLocation), std::move(members));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<EnumValue> Parser::parseEnumValue()
|
ASTPointer<EnumValue> Parser::parseEnumValue()
|
||||||
@ -918,7 +918,7 @@ pair<ASTPointer<ASTString>, SourceLocation> Parser::expectIdentifierWithLocation
|
|||||||
SourceLocation nameLocation = currentLocation();
|
SourceLocation nameLocation = currentLocation();
|
||||||
ASTPointer<ASTString> name = expectIdentifierToken();
|
ASTPointer<ASTString> name = expectIdentifierToken();
|
||||||
|
|
||||||
return {move(name), move(nameLocation)};
|
return {std::move(name), std::move(nameLocation)};
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<EventDefinition> Parser::parseEventDefinition()
|
ASTPointer<EventDefinition> Parser::parseEventDefinition()
|
||||||
@ -957,7 +957,7 @@ ASTPointer<ErrorDefinition> Parser::parseErrorDefinition()
|
|||||||
ASTPointer<ParameterList> parameters = parseParameterList({});
|
ASTPointer<ParameterList> parameters = parseParameterList({});
|
||||||
nodeFactory.markEndPosition();
|
nodeFactory.markEndPosition();
|
||||||
expectToken(Token::Semicolon);
|
expectToken(Token::Semicolon);
|
||||||
return nodeFactory.createNode<ErrorDefinition>(name, move(nameLocation), documentation, parameters);
|
return nodeFactory.createNode<ErrorDefinition>(name, std::move(nameLocation), documentation, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<UsingForDirective> Parser::parseUsingDirective()
|
ASTPointer<UsingForDirective> Parser::parseUsingDirective()
|
||||||
@ -996,7 +996,7 @@ ASTPointer<UsingForDirective> Parser::parseUsingDirective()
|
|||||||
}
|
}
|
||||||
nodeFactory.markEndPosition();
|
nodeFactory.markEndPosition();
|
||||||
expectToken(Token::Semicolon);
|
expectToken(Token::Semicolon);
|
||||||
return nodeFactory.createNode<UsingForDirective>(move(functions), usesBraces, typeName, global);
|
return nodeFactory.createNode<UsingForDirective>(std::move(functions), usesBraces, typeName, global);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<ModifierInvocation> Parser::parseModifierInvocation()
|
ASTPointer<ModifierInvocation> Parser::parseModifierInvocation()
|
||||||
@ -1014,7 +1014,7 @@ ASTPointer<ModifierInvocation> Parser::parseModifierInvocation()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
nodeFactory.setEndPositionFromNode(name);
|
nodeFactory.setEndPositionFromNode(name);
|
||||||
return nodeFactory.createNode<ModifierInvocation>(name, move(arguments));
|
return nodeFactory.createNode<ModifierInvocation>(name, std::move(arguments));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<Identifier> Parser::parseIdentifier()
|
ASTPointer<Identifier> Parser::parseIdentifier()
|
||||||
@ -1052,7 +1052,7 @@ ASTPointer<UserDefinedValueTypeDefinition> Parser::parseUserDefinedValueTypeDefi
|
|||||||
expectToken(Token::Semicolon);
|
expectToken(Token::Semicolon);
|
||||||
return nodeFactory.createNode<UserDefinedValueTypeDefinition>(
|
return nodeFactory.createNode<UserDefinedValueTypeDefinition>(
|
||||||
name,
|
name,
|
||||||
move(nameLocation),
|
std::move(nameLocation),
|
||||||
typeName
|
typeName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1377,7 +1377,7 @@ ASTPointer<InlineAssembly> Parser::parseInlineAssembly(ASTPointer<ASTString> con
|
|||||||
BOOST_THROW_EXCEPTION(FatalError());
|
BOOST_THROW_EXCEPTION(FatalError());
|
||||||
|
|
||||||
location.end = nativeLocationOf(*block).end;
|
location.end = nativeLocationOf(*block).end;
|
||||||
return make_shared<InlineAssembly>(nextID(), location, _docString, dialect, move(flags), block);
|
return make_shared<InlineAssembly>(nextID(), location, _docString, dialect, std::move(flags), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<IfStatement> Parser::parseIfStatement(ASTPointer<ASTString> const& _docString)
|
ASTPointer<IfStatement> Parser::parseIfStatement(ASTPointer<ASTString> const& _docString)
|
||||||
@ -1710,9 +1710,9 @@ pair<Parser::LookAheadInfo, Parser::IndexAccessedPath> Parser::tryParseIndexAcce
|
|||||||
IndexAccessedPath iap = parseIndexAccessedPath();
|
IndexAccessedPath iap = parseIndexAccessedPath();
|
||||||
|
|
||||||
if (m_scanner->currentToken() == Token::Identifier || TokenTraits::isLocationSpecifier(m_scanner->currentToken()))
|
if (m_scanner->currentToken() == Token::Identifier || TokenTraits::isLocationSpecifier(m_scanner->currentToken()))
|
||||||
return make_pair(LookAheadInfo::VariableDeclaration, move(iap));
|
return make_pair(LookAheadInfo::VariableDeclaration, std::move(iap));
|
||||||
else
|
else
|
||||||
return make_pair(LookAheadInfo::Expression, move(iap));
|
return make_pair(LookAheadInfo::Expression, std::move(iap));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASTPointer<VariableDeclarationStatement> Parser::parseVariableDeclarationStatement(
|
ASTPointer<VariableDeclarationStatement> Parser::parseVariableDeclarationStatement(
|
||||||
|
@ -32,7 +32,7 @@ using namespace std;
|
|||||||
using namespace solidity::util;
|
using namespace solidity::util;
|
||||||
|
|
||||||
Whiskers::Whiskers(string _template):
|
Whiskers::Whiskers(string _template):
|
||||||
m_template(move(_template))
|
m_template(std::move(_template))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ Whiskers& Whiskers::operator()(string _parameter, string _value)
|
|||||||
checkParameterValid(_parameter);
|
checkParameterValid(_parameter);
|
||||||
checkParameterUnknown(_parameter);
|
checkParameterUnknown(_parameter);
|
||||||
checkTemplateContainsTags(_parameter, {""});
|
checkTemplateContainsTags(_parameter, {""});
|
||||||
m_parameters[move(_parameter)] = move(_value);
|
m_parameters[std::move(_parameter)] = std::move(_value);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ Whiskers& Whiskers::operator()(string _parameter, bool _value)
|
|||||||
checkParameterValid(_parameter);
|
checkParameterValid(_parameter);
|
||||||
checkParameterUnknown(_parameter);
|
checkParameterUnknown(_parameter);
|
||||||
checkTemplateContainsTags(_parameter, {"?", "/"});
|
checkTemplateContainsTags(_parameter, {"?", "/"});
|
||||||
m_conditions[move(_parameter)] = _value;
|
m_conditions[std::move(_parameter)] = _value;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ Whiskers& Whiskers::operator()(
|
|||||||
for (auto const& element: _values)
|
for (auto const& element: _values)
|
||||||
for (auto const& val: element)
|
for (auto const& val: element)
|
||||||
checkParameterValid(val.first);
|
checkParameterValid(val.first);
|
||||||
m_listParameters[move(_listParameter)] = move(_values);
|
m_listParameters[std::move(_listParameter)] = std::move(_values);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void Parser::updateLocationEndFrom(
|
|||||||
DebugData updatedDebugData = *_debugData;
|
DebugData updatedDebugData = *_debugData;
|
||||||
updatedDebugData.nativeLocation.end = _location.end;
|
updatedDebugData.nativeLocation.end = _location.end;
|
||||||
updatedDebugData.originLocation.end = _location.end;
|
updatedDebugData.originLocation.end = _location.end;
|
||||||
_debugData = make_shared<DebugData const>(move(updatedDebugData));
|
_debugData = make_shared<DebugData const>(std::move(updatedDebugData));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UseSourceLocationFrom::LocationOverride:
|
case UseSourceLocationFrom::LocationOverride:
|
||||||
@ -98,7 +98,7 @@ void Parser::updateLocationEndFrom(
|
|||||||
{
|
{
|
||||||
DebugData updatedDebugData = *_debugData;
|
DebugData updatedDebugData = *_debugData;
|
||||||
updatedDebugData.nativeLocation.end = _location.end;
|
updatedDebugData.nativeLocation.end = _location.end;
|
||||||
_debugData = make_shared<DebugData const>(move(updatedDebugData));
|
_debugData = make_shared<DebugData const>(std::move(updatedDebugData));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ optional<pair<string_view, SourceLocation>> Parser::parseSrcComment(
|
|||||||
{
|
{
|
||||||
shared_ptr<string const> sourceName = m_sourceNames->at(static_cast<unsigned>(sourceIndex.value()));
|
shared_ptr<string const> sourceName = m_sourceNames->at(static_cast<unsigned>(sourceIndex.value()));
|
||||||
solAssert(sourceName, "");
|
solAssert(sourceName, "");
|
||||||
return {{tail, SourceLocation{start.value(), end.value(), move(sourceName)}}};
|
return {{tail, SourceLocation{start.value(), end.value(), std::move(sourceName)}}};
|
||||||
}
|
}
|
||||||
return {{tail, SourceLocation{}}};
|
return {{tail, SourceLocation{}}};
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ Statement Parser::parseStatement()
|
|||||||
_if.condition = make_unique<Expression>(parseExpression());
|
_if.condition = make_unique<Expression>(parseExpression());
|
||||||
_if.body = parseBlock();
|
_if.body = parseBlock();
|
||||||
updateLocationEndFrom(_if.debugData, nativeLocationOf(_if.body));
|
updateLocationEndFrom(_if.debugData, nativeLocationOf(_if.body));
|
||||||
return Statement{move(_if)};
|
return Statement{std::move(_if)};
|
||||||
}
|
}
|
||||||
case Token::Switch:
|
case Token::Switch:
|
||||||
{
|
{
|
||||||
@ -331,7 +331,7 @@ Statement Parser::parseStatement()
|
|||||||
if (_switch.cases.empty())
|
if (_switch.cases.empty())
|
||||||
fatalParserError(2418_error, "Switch statement without any cases.");
|
fatalParserError(2418_error, "Switch statement without any cases.");
|
||||||
updateLocationEndFrom(_switch.debugData, nativeLocationOf(_switch.cases.back().body));
|
updateLocationEndFrom(_switch.debugData, nativeLocationOf(_switch.cases.back().body));
|
||||||
return Statement{move(_switch)};
|
return Statement{std::move(_switch)};
|
||||||
}
|
}
|
||||||
case Token::For:
|
case Token::For:
|
||||||
return parseForLoop();
|
return parseForLoop();
|
||||||
@ -371,7 +371,7 @@ Statement Parser::parseStatement()
|
|||||||
case Token::LParen:
|
case Token::LParen:
|
||||||
{
|
{
|
||||||
Expression expr = parseCall(std::move(elementary));
|
Expression expr = parseCall(std::move(elementary));
|
||||||
return ExpressionStatement{debugDataOf(expr), move(expr)};
|
return ExpressionStatement{debugDataOf(expr), std::move(expr)};
|
||||||
}
|
}
|
||||||
case Token::Comma:
|
case Token::Comma:
|
||||||
case Token::AssemblyAssign:
|
case Token::AssemblyAssign:
|
||||||
@ -414,7 +414,7 @@ Statement Parser::parseStatement()
|
|||||||
assignment.value = make_unique<Expression>(parseExpression());
|
assignment.value = make_unique<Expression>(parseExpression());
|
||||||
updateLocationEndFrom(assignment.debugData, nativeLocationOf(*assignment.value));
|
updateLocationEndFrom(assignment.debugData, nativeLocationOf(*assignment.value));
|
||||||
|
|
||||||
return Statement{move(assignment)};
|
return Statement{std::move(assignment)};
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
fatalParserError(6913_error, "Call or assignment expected.");
|
fatalParserError(6913_error, "Call or assignment expected.");
|
||||||
@ -485,11 +485,11 @@ Expression Parser::parseExpression()
|
|||||||
nativeLocationOf(_identifier),
|
nativeLocationOf(_identifier),
|
||||||
"Builtin function \"" + _identifier.name.str() + "\" must be called."
|
"Builtin function \"" + _identifier.name.str() + "\" must be called."
|
||||||
);
|
);
|
||||||
return move(_identifier);
|
return std::move(_identifier);
|
||||||
},
|
},
|
||||||
[&](Literal& _literal) -> Expression
|
[&](Literal& _literal) -> Expression
|
||||||
{
|
{
|
||||||
return move(_literal);
|
return std::move(_literal);
|
||||||
}
|
}
|
||||||
}, operation);
|
}, operation);
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ string AsmPrinter::operator()(ForLoop const& _forLoop)
|
|||||||
delim = ' ';
|
delim = ' ';
|
||||||
return
|
return
|
||||||
locationComment +
|
locationComment +
|
||||||
("for " + move(pre) + delim + move(condition) + delim + move(post) + "\n") +
|
("for " + std::move(pre) + delim + std::move(condition) + delim + std::move(post) + "\n") +
|
||||||
(*this)(_forLoop.body);
|
(*this)(_forLoop.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void ControlFlowBuilder::operator()(FunctionDefinition const& _function)
|
|||||||
|
|
||||||
m_currentNode->successors.emplace_back(flow.exit);
|
m_currentNode->successors.emplace_back(flow.exit);
|
||||||
|
|
||||||
m_functionFlows[&_function] = move(flow);
|
m_functionFlows[&_function] = std::move(flow);
|
||||||
|
|
||||||
m_leave = nullptr;
|
m_leave = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ shared_ptr<Object> ObjectParser::parseObject(Object* _containingObject)
|
|||||||
|
|
||||||
expectToken(Token::LBrace);
|
expectToken(Token::LBrace);
|
||||||
|
|
||||||
ret->code = parseCode(move(sourceNameMapping));
|
ret->code = parseCode(std::move(sourceNameMapping));
|
||||||
|
|
||||||
while (currentToken() != Token::RBrace)
|
while (currentToken() != Token::RBrace)
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ shared_ptr<Block> ObjectParser::parseCode(optional<SourceNameMap> _sourceNames)
|
|||||||
fatalParserError(4846_error, "Expected keyword \"code\".");
|
fatalParserError(4846_error, "Expected keyword \"code\".");
|
||||||
advance();
|
advance();
|
||||||
|
|
||||||
return parseBlock(move(_sourceNames));
|
return parseBlock(std::move(_sourceNames));
|
||||||
}
|
}
|
||||||
|
|
||||||
optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
|
optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
|
||||||
@ -156,7 +156,7 @@ optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
|
|||||||
|
|
||||||
Token const next = scanner.next();
|
Token const next = scanner.next();
|
||||||
if (next == Token::EOS)
|
if (next == Token::EOS)
|
||||||
return {move(sourceNames)};
|
return {std::move(sourceNames)};
|
||||||
if (next != Token::Comma)
|
if (next != Token::Comma)
|
||||||
break;
|
break;
|
||||||
scanner.next();
|
scanner.next();
|
||||||
@ -172,7 +172,7 @@ optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
|
|||||||
|
|
||||||
shared_ptr<Block> ObjectParser::parseBlock(optional<SourceNameMap> _sourceNames)
|
shared_ptr<Block> ObjectParser::parseBlock(optional<SourceNameMap> _sourceNames)
|
||||||
{
|
{
|
||||||
Parser parser(m_errorReporter, m_dialect, move(_sourceNames));
|
Parser parser(m_errorReporter, m_dialect, std::move(_sourceNames));
|
||||||
shared_ptr<Block> block = parser.parseInline(m_scanner);
|
shared_ptr<Block> block = parser.parseInline(m_scanner);
|
||||||
yulAssert(block || m_errorReporter.hasErrors(), "Invalid block but no error!");
|
yulAssert(block || m_errorReporter.hasErrors(), "Invalid block but no error!");
|
||||||
return block;
|
return block;
|
||||||
|
@ -130,7 +130,7 @@ Representation const& RepresentationFinder::findRepresentation(u256 const& _valu
|
|||||||
|
|
||||||
if (numberEncodingSize(~_value) < numberEncodingSize(_value))
|
if (numberEncodingSize(~_value) < numberEncodingSize(_value))
|
||||||
// Negated is shorter to represent
|
// Negated is shorter to represent
|
||||||
routine = min(move(routine), represent("not"_yulstring, findRepresentation(~_value)));
|
routine = min(std::move(routine), represent("not"_yulstring, findRepresentation(~_value)));
|
||||||
|
|
||||||
// Decompose value into a * 2**k + b where abs(b) << 2**k
|
// Decompose value into a * 2**k + b where abs(b) << 2**k
|
||||||
for (unsigned bits = 255; bits > 8 && m_maxSteps > 0; --bits)
|
for (unsigned bits = 255; bits > 8 && m_maxSteps > 0; --bits)
|
||||||
@ -171,10 +171,10 @@ Representation const& RepresentationFinder::findRepresentation(u256 const& _valu
|
|||||||
|
|
||||||
if (m_maxSteps > 0)
|
if (m_maxSteps > 0)
|
||||||
m_maxSteps--;
|
m_maxSteps--;
|
||||||
routine = min(move(routine), move(newRoutine));
|
routine = min(std::move(routine), std::move(newRoutine));
|
||||||
}
|
}
|
||||||
yulAssert(MiniEVMInterpreter{m_dialect}.eval(*routine.expression) == _value, "Invalid expression generated.");
|
yulAssert(MiniEVMInterpreter{m_dialect}.eval(*routine.expression) == _value, "Invalid expression generated.");
|
||||||
return m_cache[_value] = move(routine);
|
return m_cache[_value] = std::move(routine);
|
||||||
}
|
}
|
||||||
|
|
||||||
Representation RepresentationFinder::represent(u256 const& _value) const
|
Representation RepresentationFinder::represent(u256 const& _value) const
|
||||||
|
@ -236,7 +236,7 @@ struct CFG
|
|||||||
|
|
||||||
BasicBlock& makeBlock(std::shared_ptr<DebugData const> _debugData)
|
BasicBlock& makeBlock(std::shared_ptr<DebugData const> _debugData)
|
||||||
{
|
{
|
||||||
return blocks.emplace_back(BasicBlock{move(_debugData), {}, {}});
|
return blocks.emplace_back(BasicBlock{std::move(_debugData), {}, {}});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ Stack const& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _cal
|
|||||||
return TemporarySlot{_call, _i};
|
return TemporarySlot{_call, _i};
|
||||||
}) | ranges::to<Stack>,
|
}) | ranges::to<Stack>,
|
||||||
// operation
|
// operation
|
||||||
move(builtinCall)
|
std::move(builtinCall)
|
||||||
}).output;
|
}).output;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -607,8 +607,8 @@ void ControlFlowGraphBuilder::makeConditionalJump(
|
|||||||
{
|
{
|
||||||
yulAssert(m_currentBlock, "");
|
yulAssert(m_currentBlock, "");
|
||||||
m_currentBlock->exit = CFG::BasicBlock::ConditionalJump{
|
m_currentBlock->exit = CFG::BasicBlock::ConditionalJump{
|
||||||
move(_debugData),
|
std::move(_debugData),
|
||||||
move(_condition),
|
std::move(_condition),
|
||||||
&_nonZero,
|
&_nonZero,
|
||||||
&_zero
|
&_zero
|
||||||
};
|
};
|
||||||
@ -624,7 +624,7 @@ void ControlFlowGraphBuilder::jump(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
yulAssert(m_currentBlock, "");
|
yulAssert(m_currentBlock, "");
|
||||||
m_currentBlock->exit = CFG::BasicBlock::Jump{move(_debugData), &_target, backwards};
|
m_currentBlock->exit = CFG::BasicBlock::Jump{std::move(_debugData), &_target, backwards};
|
||||||
_target.entries.emplace_back(m_currentBlock);
|
_target.entries.emplace_back(m_currentBlock);
|
||||||
m_currentBlock = &_target;
|
m_currentBlock = &_target;
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,9 @@ CodeTransform::CodeTransform(
|
|||||||
m_builtinContext(_builtinContext),
|
m_builtinContext(_builtinContext),
|
||||||
m_allowStackOpt(_allowStackOpt),
|
m_allowStackOpt(_allowStackOpt),
|
||||||
m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions),
|
m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions),
|
||||||
m_identifierAccessCodeGen(move(_identifierAccessCodeGen)),
|
m_identifierAccessCodeGen(std::move(_identifierAccessCodeGen)),
|
||||||
m_context(move(_context)),
|
m_context(std::move(_context)),
|
||||||
m_delayedReturnVariables(move(_delayedReturnVariables)),
|
m_delayedReturnVariables(std::move(_delayedReturnVariables)),
|
||||||
m_functionExitLabel(_functionExitLabel)
|
m_functionExitLabel(_functionExitLabel)
|
||||||
{
|
{
|
||||||
if (!m_context)
|
if (!m_context)
|
||||||
@ -406,11 +406,11 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
|
|||||||
if (!m_allowStackOpt)
|
if (!m_allowStackOpt)
|
||||||
subTransform.setupReturnVariablesAndFunctionExit();
|
subTransform.setupReturnVariablesAndFunctionExit();
|
||||||
|
|
||||||
subTransform.m_assignedNamedLabels = move(m_assignedNamedLabels);
|
subTransform.m_assignedNamedLabels = std::move(m_assignedNamedLabels);
|
||||||
|
|
||||||
subTransform(_function.body);
|
subTransform(_function.body);
|
||||||
|
|
||||||
m_assignedNamedLabels = move(subTransform.m_assignedNamedLabels);
|
m_assignedNamedLabels = std::move(subTransform.m_assignedNamedLabels);
|
||||||
|
|
||||||
m_assembly.setSourceLocation(originLocationOf(_function));
|
m_assembly.setSourceLocation(originLocationOf(_function));
|
||||||
if (!subTransform.m_stackErrors.empty())
|
if (!subTransform.m_stackErrors.empty())
|
||||||
|
@ -383,7 +383,7 @@ BuiltinFunctionForEVM const* EVMDialect::verbatimFunction(size_t _arguments, siz
|
|||||||
}
|
}
|
||||||
).second;
|
).second;
|
||||||
builtinFunction.isMSize = true;
|
builtinFunction.isMSize = true;
|
||||||
function = make_shared<BuiltinFunctionForEVM const>(move(builtinFunction));
|
function = make_shared<BuiltinFunctionForEVM const>(std::move(builtinFunction));
|
||||||
}
|
}
|
||||||
return function.get();
|
return function.get();
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void EthAssemblyAdapter::appendLinkerSymbol(std::string const& _linkerSymbol)
|
|||||||
|
|
||||||
void EthAssemblyAdapter::appendVerbatim(bytes _data, size_t _arguments, size_t _returnVariables)
|
void EthAssemblyAdapter::appendVerbatim(bytes _data, size_t _arguments, size_t _returnVariables)
|
||||||
{
|
{
|
||||||
m_assembly.appendVerbatim(move(_data), _arguments, _returnVariables);
|
m_assembly.appendVerbatim(std::move(_data), _arguments, _returnVariables);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EthAssemblyAdapter::appendJump(int _stackDiffAfter, JumpType _jumpType)
|
void EthAssemblyAdapter::appendJump(int _stackDiffAfter, JumpType _jumpType)
|
||||||
|
@ -61,7 +61,7 @@ vector<StackTooDeepError> OptimizedEVMCodeTransform::run(
|
|||||||
optimizedCodeTransform(*dfg->entry);
|
optimizedCodeTransform(*dfg->entry);
|
||||||
for (Scope::Function const* function: dfg->functions)
|
for (Scope::Function const* function: dfg->functions)
|
||||||
optimizedCodeTransform(dfg->functionInfo.at(function));
|
optimizedCodeTransform(dfg->functionInfo.at(function));
|
||||||
return move(optimizedCodeTransform.m_stackErrors);
|
return std::move(optimizedCodeTransform.m_stackErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call)
|
void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call)
|
||||||
@ -459,7 +459,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::BasicBlock const& _block)
|
|||||||
{
|
{
|
||||||
// Restore the stack afterwards for the non-zero case below.
|
// Restore the stack afterwards for the non-zero case below.
|
||||||
ScopeGuard stackRestore([storedStack = m_stack, this]() {
|
ScopeGuard stackRestore([storedStack = m_stack, this]() {
|
||||||
m_stack = move(storedStack);
|
m_stack = std::move(storedStack);
|
||||||
m_assembly.setStackHeight(static_cast<int>(m_stack.size()));
|
m_assembly.setStackHeight(static_cast<int>(m_stack.size()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ map<YulString, vector<StackLayoutGenerator::StackTooDeep>> StackLayoutGenerator:
|
|||||||
stackTooDeepErrors[YulString{}] = reportStackTooDeep(_cfg, YulString{});
|
stackTooDeepErrors[YulString{}] = reportStackTooDeep(_cfg, YulString{});
|
||||||
for (auto const& function: _cfg.functions)
|
for (auto const& function: _cfg.functions)
|
||||||
if (auto errors = reportStackTooDeep(_cfg, function->name); !errors.empty())
|
if (auto errors = reportStackTooDeep(_cfg, function->name); !errors.empty())
|
||||||
stackTooDeepErrors[function->name] = move(errors);
|
stackTooDeepErrors[function->name] = std::move(errors);
|
||||||
return stackTooDeepErrors;
|
return stackTooDeepErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,8 +324,8 @@ Stack StackLayoutGenerator::propagateStackThroughBlock(Stack _exitStack, CFG::Ba
|
|||||||
Stack newStack = propagateStackThroughOperation(stack, operation, _aggressiveStackCompression);
|
Stack newStack = propagateStackThroughOperation(stack, operation, _aggressiveStackCompression);
|
||||||
if (!_aggressiveStackCompression && !findStackTooDeep(newStack, stack).empty())
|
if (!_aggressiveStackCompression && !findStackTooDeep(newStack, stack).empty())
|
||||||
// If we had stack errors, run again with aggressive stack compression.
|
// If we had stack errors, run again with aggressive stack compression.
|
||||||
return propagateStackThroughBlock(move(_exitStack), _block, true);
|
return propagateStackThroughBlock(std::move(_exitStack), _block, true);
|
||||||
stack = move(newStack);
|
stack = std::move(newStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
@ -715,13 +715,13 @@ void StackLayoutGenerator::fillInJunk(CFG::BasicBlock const& _block)
|
|||||||
util::BreadthFirstSearch<CFG::BasicBlock const*> breadthFirstSearch{{_entry}};
|
util::BreadthFirstSearch<CFG::BasicBlock const*> breadthFirstSearch{{_entry}};
|
||||||
breadthFirstSearch.run([&](CFG::BasicBlock const* _block, auto _addChild) {
|
breadthFirstSearch.run([&](CFG::BasicBlock const* _block, auto _addChild) {
|
||||||
auto& blockInfo = m_layout.blockInfos.at(_block);
|
auto& blockInfo = m_layout.blockInfos.at(_block);
|
||||||
blockInfo.entryLayout = Stack{_numJunk, JunkSlot{}} + move(blockInfo.entryLayout);
|
blockInfo.entryLayout = Stack{_numJunk, JunkSlot{}} + std::move(blockInfo.entryLayout);
|
||||||
for (auto const& operation: _block->operations)
|
for (auto const& operation: _block->operations)
|
||||||
{
|
{
|
||||||
auto& operationEntryLayout = m_layout.operationEntryLayout.at(&operation);
|
auto& operationEntryLayout = m_layout.operationEntryLayout.at(&operation);
|
||||||
operationEntryLayout = Stack{_numJunk, JunkSlot{}} + move(operationEntryLayout);
|
operationEntryLayout = Stack{_numJunk, JunkSlot{}} + std::move(operationEntryLayout);
|
||||||
}
|
}
|
||||||
blockInfo.exitLayout = Stack{_numJunk, JunkSlot{}} + move(blockInfo.exitLayout);
|
blockInfo.exitLayout = Stack{_numJunk, JunkSlot{}} + std::move(blockInfo.exitLayout);
|
||||||
|
|
||||||
std::visit(util::GenericVisitor{
|
std::visit(util::GenericVisitor{
|
||||||
[&](CFG::BasicBlock::MainExit const&) {},
|
[&](CFG::BasicBlock::MainExit const&) {},
|
||||||
|
@ -239,12 +239,12 @@ static map<string, uint8_t> const builtins = {
|
|||||||
bytes prefixSize(bytes _data)
|
bytes prefixSize(bytes _data)
|
||||||
{
|
{
|
||||||
size_t size = _data.size();
|
size_t size = _data.size();
|
||||||
return lebEncode(size) + move(_data);
|
return lebEncode(size) + std::move(_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes makeSection(Section _section, bytes _data)
|
bytes makeSection(Section _section, bytes _data)
|
||||||
{
|
{
|
||||||
return toBytes(_section) + prefixSize(move(_data));
|
return toBytes(_section) + prefixSize(std::move(_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is a kind of run-length-encoding of local types.
|
/// This is a kind of run-length-encoding of local types.
|
||||||
@ -306,7 +306,7 @@ bytes BinaryTransform::run(Module const& _module)
|
|||||||
// TODO should we prefix and / or shorten the name?
|
// TODO should we prefix and / or shorten the name?
|
||||||
bytes data = BinaryTransform::run(module);
|
bytes data = BinaryTransform::run(module);
|
||||||
size_t const length = data.size();
|
size_t const length = data.size();
|
||||||
ret += customSection(name, move(data));
|
ret += customSection(name, std::move(data));
|
||||||
// Skip all the previous sections and the size field of this current custom section.
|
// Skip all the previous sections and the size field of this current custom section.
|
||||||
size_t const offset = ret.size() - length;
|
size_t const offset = ret.size() - length;
|
||||||
subModulePosAndSize[name] = {offset, length};
|
subModulePosAndSize[name] = {offset, length};
|
||||||
@ -321,10 +321,10 @@ bytes BinaryTransform::run(Module const& _module)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BinaryTransform bt(
|
BinaryTransform bt(
|
||||||
move(globalIDs),
|
std::move(globalIDs),
|
||||||
move(functionIDs),
|
std::move(functionIDs),
|
||||||
move(functionTypes),
|
std::move(functionTypes),
|
||||||
move(subModulePosAndSize)
|
std::move(subModulePosAndSize)
|
||||||
);
|
);
|
||||||
|
|
||||||
ret += bt.codeSection(_module.functions);
|
ret += bt.codeSection(_module.functions);
|
||||||
@ -378,7 +378,7 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call)
|
|||||||
yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found");
|
yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found");
|
||||||
// NOTE: the dialect ensures we have the right amount of arguments
|
// NOTE: the dialect ensures we have the right amount of arguments
|
||||||
bytes args = visit(_call.arguments);
|
bytes args = visit(_call.arguments);
|
||||||
bytes ret = move(args) + toBytes(builtins.at(_call.functionName));
|
bytes ret = std::move(args) + toBytes(builtins.at(_call.functionName));
|
||||||
if (
|
if (
|
||||||
_call.functionName.find(".load") != string::npos ||
|
_call.functionName.find(".load") != string::npos ||
|
||||||
_call.functionName.find(".store") != string::npos
|
_call.functionName.find(".store") != string::npos
|
||||||
@ -500,7 +500,7 @@ bytes BinaryTransform::operator()(FunctionDefinition const& _function)
|
|||||||
|
|
||||||
yulAssert(m_labels.empty(), "Stray labels.");
|
yulAssert(m_labels.empty(), "Stray labels.");
|
||||||
|
|
||||||
return prefixSize(move(ret));
|
return prefixSize(std::move(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import)
|
BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import)
|
||||||
@ -602,7 +602,7 @@ bytes BinaryTransform::typeSection(map<BinaryTransform::Type, vector<string>> co
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeSection(Section::TYPE, lebEncode(index) + move(result));
|
return makeSection(Section::TYPE, lebEncode(index) + std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::importSection(
|
bytes BinaryTransform::importSection(
|
||||||
@ -620,7 +620,7 @@ bytes BinaryTransform::importSection(
|
|||||||
toBytes(importKind) +
|
toBytes(importKind) +
|
||||||
lebEncode(_functionTypes.at(import.internalName));
|
lebEncode(_functionTypes.at(import.internalName));
|
||||||
}
|
}
|
||||||
return makeSection(Section::IMPORT, move(result));
|
return makeSection(Section::IMPORT, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::functionSection(
|
bytes BinaryTransform::functionSection(
|
||||||
@ -631,7 +631,7 @@ bytes BinaryTransform::functionSection(
|
|||||||
bytes result = lebEncode(_functions.size());
|
bytes result = lebEncode(_functions.size());
|
||||||
for (auto const& fun: _functions)
|
for (auto const& fun: _functions)
|
||||||
result += lebEncode(_functionTypes.at(fun.name));
|
result += lebEncode(_functionTypes.at(fun.name));
|
||||||
return makeSection(Section::FUNCTION, move(result));
|
return makeSection(Section::FUNCTION, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::memorySection()
|
bytes BinaryTransform::memorySection()
|
||||||
@ -639,7 +639,7 @@ bytes BinaryTransform::memorySection()
|
|||||||
bytes result = lebEncode(1);
|
bytes result = lebEncode(1);
|
||||||
result.push_back(static_cast<uint8_t>(LimitsKind::Min));
|
result.push_back(static_cast<uint8_t>(LimitsKind::Min));
|
||||||
result.push_back(1); // initial length
|
result.push_back(1); // initial length
|
||||||
return makeSection(Section::MEMORY, move(result));
|
return makeSection(Section::MEMORY, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::globalSection(vector<wasm::GlobalVariableDeclaration> const& _globals)
|
bytes BinaryTransform::globalSection(vector<wasm::GlobalVariableDeclaration> const& _globals)
|
||||||
@ -656,7 +656,7 @@ bytes BinaryTransform::globalSection(vector<wasm::GlobalVariableDeclaration> con
|
|||||||
toBytes(Opcode::End);
|
toBytes(Opcode::End);
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeSection(Section::GLOBAL, move(result));
|
return makeSection(Section::GLOBAL, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::exportSection(map<string, size_t> const& _functionIDs)
|
bytes BinaryTransform::exportSection(map<string, size_t> const& _functionIDs)
|
||||||
@ -666,13 +666,13 @@ bytes BinaryTransform::exportSection(map<string, size_t> const& _functionIDs)
|
|||||||
result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0);
|
result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0);
|
||||||
if (hasMain)
|
if (hasMain)
|
||||||
result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functionIDs.at("main"));
|
result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functionIDs.at("main"));
|
||||||
return makeSection(Section::EXPORT, move(result));
|
return makeSection(Section::EXPORT, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::customSection(string const& _name, bytes _data)
|
bytes BinaryTransform::customSection(string const& _name, bytes _data)
|
||||||
{
|
{
|
||||||
bytes result = encodeName(_name) + move(_data);
|
bytes result = encodeName(_name) + std::move(_data);
|
||||||
return makeSection(Section::CUSTOM, move(result));
|
return makeSection(Section::CUSTOM, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::codeSection(vector<wasm::FunctionDefinition> const& _functions)
|
bytes BinaryTransform::codeSection(vector<wasm::FunctionDefinition> const& _functions)
|
||||||
@ -680,7 +680,7 @@ bytes BinaryTransform::codeSection(vector<wasm::FunctionDefinition> const& _func
|
|||||||
bytes result = lebEncode(_functions.size());
|
bytes result = lebEncode(_functions.size());
|
||||||
for (FunctionDefinition const& fun: _functions)
|
for (FunctionDefinition const& fun: _functions)
|
||||||
result += (*this)(fun);
|
result += (*this)(fun);
|
||||||
return makeSection(Section::CODE, move(result));
|
return makeSection(Section::CODE, std::move(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes BinaryTransform::visit(vector<Expression> const& _expressions)
|
bytes BinaryTransform::visit(vector<Expression> const& _expressions)
|
||||||
|
@ -92,7 +92,7 @@ Object EVMToEwasmTranslator::run(Object const& _object)
|
|||||||
|
|
||||||
Object ret;
|
Object ret;
|
||||||
ret.name = _object.name;
|
ret.name = _object.name;
|
||||||
ret.code = make_shared<Block>(move(ast));
|
ret.code = make_shared<Block>(std::move(ast));
|
||||||
ret.debugData = _object.debugData;
|
ret.debugData = _object.debugData;
|
||||||
ret.analysisInfo = make_shared<AsmAnalysisInfo>();
|
ret.analysisInfo = make_shared<AsmAnalysisInfo>();
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ string TextTransform::run(wasm::Module const& _module)
|
|||||||
ret += "\n";
|
ret += "\n";
|
||||||
for (auto const& f: _module.functions)
|
for (auto const& f: _module.functions)
|
||||||
ret += transform(f) + "\n";
|
ret += transform(f) + "\n";
|
||||||
return move(ret) + ")\n";
|
return std::move(ret) + ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string TextTransform::operator()(wasm::Literal const& _literal)
|
string TextTransform::operator()(wasm::Literal const& _literal)
|
||||||
@ -159,7 +159,7 @@ string TextTransform::operator()(wasm::If const& _if)
|
|||||||
string TextTransform::operator()(wasm::Loop const& _loop)
|
string TextTransform::operator()(wasm::Loop const& _loop)
|
||||||
{
|
{
|
||||||
string label = _loop.labelName.empty() ? "" : " $" + _loop.labelName;
|
string label = _loop.labelName.empty() ? "" : " $" + _loop.labelName;
|
||||||
return "(loop" + move(label) + "\n" + indented(joinTransformed(_loop.statements, '\n')) + ")\n";
|
return "(loop" + std::move(label) + "\n" + indented(joinTransformed(_loop.statements, '\n')) + ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string TextTransform::operator()(wasm::Branch const& _branch)
|
string TextTransform::operator()(wasm::Branch const& _branch)
|
||||||
@ -180,7 +180,7 @@ string TextTransform::operator()(wasm::Return const&)
|
|||||||
string TextTransform::operator()(wasm::Block const& _block)
|
string TextTransform::operator()(wasm::Block const& _block)
|
||||||
{
|
{
|
||||||
string label = _block.labelName.empty() ? "" : " $" + _block.labelName;
|
string label = _block.labelName.empty() ? "" : " $" + _block.labelName;
|
||||||
return "(block" + move(label) + "\n" + indented(joinTransformed(_block.statements, '\n')) + "\n)\n";
|
return "(block" + std::move(label) + "\n" + indented(joinTransformed(_block.statements, '\n')) + "\n)\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
string TextTransform::indented(string const& _in)
|
string TextTransform::indented(string const& _in)
|
||||||
@ -230,7 +230,7 @@ string TextTransform::joinTransformed(vector<wasm::Expression> const& _expressio
|
|||||||
string t = visit(e);
|
string t = visit(e);
|
||||||
if (!t.empty() && !ret.empty() && ret.back() != '\n')
|
if (!t.empty() && !ret.empty() && ret.back() != '\n')
|
||||||
ret += _separator;
|
ret += _separator;
|
||||||
ret += move(t);
|
ret += std::move(t);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ wasm::Expression WasmCodeTransform::generateMultiAssignment(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
yulAssert(!_variableNames.empty(), "");
|
yulAssert(!_variableNames.empty(), "");
|
||||||
wasm::LocalAssignment assignment{move(_variableNames.front()), std::move(_firstValue)};
|
wasm::LocalAssignment assignment{std::move(_variableNames.front()), std::move(_firstValue)};
|
||||||
|
|
||||||
if (_variableNames.size() == 1)
|
if (_variableNames.size() == 1)
|
||||||
return { std::move(assignment) };
|
return { std::move(assignment) };
|
||||||
@ -80,10 +80,10 @@ wasm::Expression WasmCodeTransform::generateMultiAssignment(
|
|||||||
yulAssert(allocatedIndices.size() == _variableNames.size() - 1, "");
|
yulAssert(allocatedIndices.size() == _variableNames.size() - 1, "");
|
||||||
|
|
||||||
wasm::Block block;
|
wasm::Block block;
|
||||||
block.statements.emplace_back(move(assignment));
|
block.statements.emplace_back(std::move(assignment));
|
||||||
for (size_t i = 1; i < _variableNames.size(); ++i)
|
for (size_t i = 1; i < _variableNames.size(); ++i)
|
||||||
block.statements.emplace_back(wasm::LocalAssignment{
|
block.statements.emplace_back(wasm::LocalAssignment{
|
||||||
move(_variableNames.at(i)),
|
std::move(_variableNames.at(i)),
|
||||||
make_unique<wasm::Expression>(wasm::GlobalVariable{m_globalVariables.at(allocatedIndices[i - 1]).variableName})
|
make_unique<wasm::Expression>(wasm::GlobalVariable{m_globalVariables.at(allocatedIndices[i - 1]).variableName})
|
||||||
});
|
});
|
||||||
return { std::move(block) };
|
return { std::move(block) };
|
||||||
@ -99,7 +99,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::VariableDeclaration const& _
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_varDecl.value)
|
if (_varDecl.value)
|
||||||
return generateMultiAssignment(move(variableNames), visit(*_varDecl.value));
|
return generateMultiAssignment(std::move(variableNames), visit(*_varDecl.value));
|
||||||
else
|
else
|
||||||
return wasm::BuiltinCall{"nop", {}};
|
return wasm::BuiltinCall{"nop", {}};
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::Assignment const& _assignmen
|
|||||||
vector<string> variableNames;
|
vector<string> variableNames;
|
||||||
for (auto const& var: _assignment.variableNames)
|
for (auto const& var: _assignment.variableNames)
|
||||||
variableNames.emplace_back(var.name.str());
|
variableNames.emplace_back(var.name.str());
|
||||||
return generateMultiAssignment(move(variableNames), visit(*_assignment.value));
|
return generateMultiAssignment(std::move(variableNames), visit(*_assignment.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
wasm::Expression WasmCodeTransform::operator()(yul::ExpressionStatement const& _statement)
|
wasm::Expression WasmCodeTransform::operator()(yul::ExpressionStatement const& _statement)
|
||||||
@ -134,7 +134,7 @@ void WasmCodeTransform::importBuiltinFunction(BuiltinFunction const* _builtin, s
|
|||||||
};
|
};
|
||||||
for (auto const& param: _builtin->parameters)
|
for (auto const& param: _builtin->parameters)
|
||||||
imp.paramTypes.emplace_back(translatedType(param));
|
imp.paramTypes.emplace_back(translatedType(param));
|
||||||
m_functionsToImport[internalName] = move(imp);
|
m_functionsToImport[internalName] = std::move(imp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::If const& _if)
|
|||||||
else
|
else
|
||||||
yulAssert(false, "Invalid condition type");
|
yulAssert(false, "Invalid condition type");
|
||||||
|
|
||||||
return wasm::If{make_unique<wasm::Expression>(move(condition)), visit(_if.body.statements), {}};
|
return wasm::If{make_unique<wasm::Expression>(std::move(condition)), visit(_if.body.statements), {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
||||||
@ -224,7 +224,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
|||||||
visitReturnByValue(*c.value)
|
visitReturnByValue(*c.value)
|
||||||
)};
|
)};
|
||||||
wasm::If ifStmnt{
|
wasm::If ifStmnt{
|
||||||
make_unique<wasm::Expression>(move(comparison)),
|
make_unique<wasm::Expression>(std::move(comparison)),
|
||||||
visit(c.body.statements),
|
visit(c.body.statements),
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
@ -234,7 +234,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
|||||||
ifStmnt.elseStatements = make_unique<vector<wasm::Expression>>();
|
ifStmnt.elseStatements = make_unique<vector<wasm::Expression>>();
|
||||||
nextBlock = ifStmnt.elseStatements.get();
|
nextBlock = ifStmnt.elseStatements.get();
|
||||||
}
|
}
|
||||||
currentBlock->emplace_back(move(ifStmnt));
|
currentBlock->emplace_back(std::move(ifStmnt));
|
||||||
currentBlock = nextBlock;
|
currentBlock = nextBlock;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -275,8 +275,8 @@ wasm::Expression WasmCodeTransform::operator()(yul::ForLoop const& _for)
|
|||||||
loop.statements += visit(_for.post.statements);
|
loop.statements += visit(_for.post.statements);
|
||||||
loop.statements.emplace_back(wasm::Branch{wasm::Label{loop.labelName}});
|
loop.statements.emplace_back(wasm::Branch{wasm::Label{loop.labelName}});
|
||||||
|
|
||||||
statements += make_vector<wasm::Expression>(move(loop));
|
statements += make_vector<wasm::Expression>(std::move(loop));
|
||||||
return wasm::Block{breakLabel, move(statements)};
|
return wasm::Block{breakLabel, std::move(statements)};
|
||||||
}
|
}
|
||||||
|
|
||||||
wasm::Expression WasmCodeTransform::operator()(yul::Break const&)
|
wasm::Expression WasmCodeTransform::operator()(yul::Break const&)
|
||||||
|
@ -269,7 +269,7 @@ void WasmDialect::addFunction(
|
|||||||
vector<optional<LiteralKind>> _literalArguments
|
vector<optional<LiteralKind>> _literalArguments
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
YulString name{move(_name)};
|
YulString name{std::move(_name)};
|
||||||
BuiltinFunction& f = m_functions[name];
|
BuiltinFunction& f = m_functions[name];
|
||||||
f.name = name;
|
f.name = name;
|
||||||
f.parameters = std::move(_params);
|
f.parameters = std::move(_params);
|
||||||
|
@ -64,7 +64,7 @@ private:
|
|||||||
Dialect const& _dialect,
|
Dialect const& _dialect,
|
||||||
std::map<YulString, ControlFlowSideEffects> _sideEffects
|
std::map<YulString, ControlFlowSideEffects> _sideEffects
|
||||||
):
|
):
|
||||||
m_dialect(_dialect), m_functionSideEffects(move(_sideEffects))
|
m_dialect(_dialect), m_functionSideEffects(std::move(_sideEffects))
|
||||||
{}
|
{}
|
||||||
Dialect const& m_dialect;
|
Dialect const& m_dialect;
|
||||||
std::map<YulString, ControlFlowSideEffects> m_functionSideEffects;
|
std::map<YulString, ControlFlowSideEffects> m_functionSideEffects;
|
||||||
|
@ -63,7 +63,7 @@ private:
|
|||||||
DeadCodeEliminator(
|
DeadCodeEliminator(
|
||||||
Dialect const& _dialect,
|
Dialect const& _dialect,
|
||||||
std::map<YulString, ControlFlowSideEffects> _sideEffects
|
std::map<YulString, ControlFlowSideEffects> _sideEffects
|
||||||
): m_dialect(_dialect), m_functionSideEffects(move(_sideEffects)) {}
|
): m_dialect(_dialect), m_functionSideEffects(std::move(_sideEffects)) {}
|
||||||
|
|
||||||
Dialect const& m_dialect;
|
Dialect const& m_dialect;
|
||||||
std::map<YulString, ControlFlowSideEffects> m_functionSideEffects;
|
std::map<YulString, ControlFlowSideEffects> m_functionSideEffects;
|
||||||
|
@ -40,7 +40,7 @@ void ForLoopInitRewriter::operator()(Block& _block)
|
|||||||
(*this)(forLoop.post);
|
(*this)(forLoop.post);
|
||||||
vector<Statement> rewrite;
|
vector<Statement> rewrite;
|
||||||
swap(rewrite, forLoop.pre.statements);
|
swap(rewrite, forLoop.pre.statements);
|
||||||
rewrite.emplace_back(move(forLoop));
|
rewrite.emplace_back(std::move(forLoop));
|
||||||
return { std::move(rewrite) };
|
return { std::move(rewrite) };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -65,7 +65,7 @@ void FunctionSpecializer::operator()(FunctionCall& _f)
|
|||||||
|
|
||||||
if (ranges::any_of(arguments, [](auto& _a) { return _a.has_value(); }))
|
if (ranges::any_of(arguments, [](auto& _a) { return _a.has_value(); }))
|
||||||
{
|
{
|
||||||
YulString oldName = move(_f.functionName.name);
|
YulString oldName = std::move(_f.functionName.name);
|
||||||
auto newName = m_nameDispenser.newName(oldName);
|
auto newName = m_nameDispenser.newName(oldName);
|
||||||
|
|
||||||
m_oldToNewMap[oldName].emplace_back(make_pair(newName, arguments));
|
m_oldToNewMap[oldName].emplace_back(make_pair(newName, arguments));
|
||||||
@ -106,12 +106,12 @@ FunctionDefinition FunctionSpecializer::specialize(
|
|||||||
VariableDeclaration{
|
VariableDeclaration{
|
||||||
_f.debugData,
|
_f.debugData,
|
||||||
vector<TypedName>{newFunction.parameters[index]},
|
vector<TypedName>{newFunction.parameters[index]},
|
||||||
make_unique<Expression>(move(*argument))
|
make_unique<Expression>(std::move(*argument))
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
newFunction.body.statements =
|
newFunction.body.statements =
|
||||||
move(missingVariableDeclarations) + move(newFunction.body.statements);
|
std::move(missingVariableDeclarations) + std::move(newFunction.body.statements);
|
||||||
|
|
||||||
// Only take those indices that cannot be specialized, i.e., whose value is `nullopt`.
|
// Only take those indices that cannot be specialized, i.e., whose value is `nullopt`.
|
||||||
newFunction.parameters =
|
newFunction.parameters =
|
||||||
@ -120,7 +120,7 @@ FunctionDefinition FunctionSpecializer::specialize(
|
|||||||
applyMap(_arguments, [&](auto const& _v) { return !_v; })
|
applyMap(_arguments, [&](auto const& _v) { return !_v; })
|
||||||
);
|
);
|
||||||
|
|
||||||
newFunction.name = move(_newName);
|
newFunction.name = std::move(_newName);
|
||||||
|
|
||||||
return newFunction;
|
return newFunction;
|
||||||
}
|
}
|
||||||
@ -146,10 +146,10 @@ void FunctionSpecializer::run(OptimiserStepContext& _context, Block& _ast)
|
|||||||
f.m_oldToNewMap.at(functionDefinition.name),
|
f.m_oldToNewMap.at(functionDefinition.name),
|
||||||
[&](auto& _p) -> Statement
|
[&](auto& _p) -> Statement
|
||||||
{
|
{
|
||||||
return f.specialize(functionDefinition, move(_p.first), move(_p.second));
|
return f.specialize(functionDefinition, std::move(_p.first), std::move(_p.second));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return move(out) + make_vector<Statement>(move(functionDefinition));
|
return std::move(out) + make_vector<Statement>(std::move(functionDefinition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ optional<u256> KnowledgeBase::valueIfKnownConstant(YulString _a)
|
|||||||
Expression KnowledgeBase::simplify(Expression _expression)
|
Expression KnowledgeBase::simplify(Expression _expression)
|
||||||
{
|
{
|
||||||
m_counter = 0;
|
m_counter = 0;
|
||||||
return simplifyRecursively(move(_expression));
|
return simplifyRecursively(std::move(_expression));
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression KnowledgeBase::simplifyRecursively(Expression _expression)
|
Expression KnowledgeBase::simplifyRecursively(Expression _expression)
|
||||||
|
@ -37,7 +37,7 @@ using namespace solidity::util;
|
|||||||
NameDispenser::NameDispenser(Dialect const& _dialect, Block const& _ast, set<YulString> _reservedNames):
|
NameDispenser::NameDispenser(Dialect const& _dialect, Block const& _ast, set<YulString> _reservedNames):
|
||||||
NameDispenser(_dialect, NameCollector(_ast).names() + _reservedNames)
|
NameDispenser(_dialect, NameCollector(_ast).names() + _reservedNames)
|
||||||
{
|
{
|
||||||
m_reservedNames = move(_reservedNames);
|
m_reservedNames = std::move(_reservedNames);
|
||||||
}
|
}
|
||||||
|
|
||||||
NameDispenser::NameDispenser(Dialect const& _dialect, set<YulString> _usedNames):
|
NameDispenser::NameDispenser(Dialect const& _dialect, set<YulString> _usedNames):
|
||||||
|
@ -111,7 +111,7 @@ void NameSimplifier::findSimplification(YulString const& _name)
|
|||||||
{
|
{
|
||||||
YulString newName{name};
|
YulString newName{name};
|
||||||
m_context.dispenser.markUsed(newName);
|
m_context.dispenser.markUsed(newName);
|
||||||
m_translations[_name] = move(newName);
|
m_translations[_name] = std::move(newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ void ReasoningBasedSimplifier::operator()(If& _if)
|
|||||||
{
|
{
|
||||||
Literal trueCondition = m_dialect.trueLiteral();
|
Literal trueCondition = m_dialect.trueLiteral();
|
||||||
trueCondition.debugData = debugDataOf(*_if.condition);
|
trueCondition.debugData = debugDataOf(*_if.condition);
|
||||||
_if.condition = make_unique<yul::Expression>(move(trueCondition));
|
_if.condition = make_unique<yul::Expression>(std::move(trueCondition));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -83,7 +83,7 @@ void ReasoningBasedSimplifier::operator()(If& _if)
|
|||||||
{
|
{
|
||||||
Literal falseCondition = m_dialect.zeroLiteralForType(m_dialect.boolType);
|
Literal falseCondition = m_dialect.zeroLiteralForType(m_dialect.boolType);
|
||||||
falseCondition.debugData = debugDataOf(*_if.condition);
|
falseCondition.debugData = debugDataOf(*_if.condition);
|
||||||
_if.condition = make_unique<yul::Expression>(move(falseCondition));
|
_if.condition = make_unique<yul::Expression>(std::move(falseCondition));
|
||||||
_if.body = yul::Block{};
|
_if.body = yul::Block{};
|
||||||
// Nothing left to be done.
|
// Nothing left to be done.
|
||||||
return;
|
return;
|
||||||
|
@ -176,7 +176,7 @@ void eliminateVariables(
|
|||||||
varsToEliminate += chooseVarsToEliminate(candidates[functionName], static_cast<size_t>(numVariables));
|
varsToEliminate += chooseVarsToEliminate(candidates[functionName], static_cast<size_t>(numVariables));
|
||||||
}
|
}
|
||||||
|
|
||||||
Rematerialiser::run(_dialect, _ast, move(varsToEliminate));
|
Rematerialiser::run(_dialect, _ast, std::move(varsToEliminate));
|
||||||
// Do not remove functions.
|
// Do not remove functions.
|
||||||
set<YulString> allFunctions = NameCollector{_ast, NameCollector::OnlyFunctions}.names();
|
set<YulString> allFunctions = NameCollector{_ast, NameCollector::OnlyFunctions}.names();
|
||||||
UnusedPruner::runUntilStabilised(_dialect, _ast, _allowMSizeOptimization, nullptr, allFunctions);
|
UnusedPruner::runUntilStabilised(_dialect, _ast, _allowMSizeOptimization, nullptr, allFunctions);
|
||||||
|
@ -50,7 +50,7 @@ vector<Statement> generateMemoryStore(
|
|||||||
Identifier{_debugData, memoryStoreFunction->name},
|
Identifier{_debugData, memoryStoreFunction->name},
|
||||||
{
|
{
|
||||||
Literal{_debugData, LiteralKind::Number, _mpos, {}},
|
Literal{_debugData, LiteralKind::Number, _mpos, {}},
|
||||||
move(_value)
|
std::move(_value)
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
return result;
|
return result;
|
||||||
@ -95,7 +95,7 @@ void StackToMemoryMover::run(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
stackToMemoryMover(_block);
|
stackToMemoryMover(_block);
|
||||||
_block.statements += move(stackToMemoryMover.m_newFunctionDefinitions);
|
_block.statements += std::move(stackToMemoryMover.m_newFunctionDefinitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
StackToMemoryMover::StackToMemoryMover(
|
StackToMemoryMover::StackToMemoryMover(
|
||||||
@ -106,7 +106,7 @@ StackToMemoryMover::StackToMemoryMover(
|
|||||||
m_context(_context),
|
m_context(_context),
|
||||||
m_memoryOffsetTracker(_memoryOffsetTracker),
|
m_memoryOffsetTracker(_memoryOffsetTracker),
|
||||||
m_nameDispenser(_context.dispenser),
|
m_nameDispenser(_context.dispenser),
|
||||||
m_functionReturnVariables(move(_functionReturnVariables))
|
m_functionReturnVariables(std::move(_functionReturnVariables))
|
||||||
{
|
{
|
||||||
auto const* evmDialect = dynamic_cast<EVMDialect const*>(&_context.dialect);
|
auto const* evmDialect = dynamic_cast<EVMDialect const*>(&_context.dialect);
|
||||||
yulAssert(
|
yulAssert(
|
||||||
@ -156,7 +156,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition)
|
|||||||
newFunctionName,
|
newFunctionName,
|
||||||
stackParameters,
|
stackParameters,
|
||||||
{},
|
{},
|
||||||
move(_functionDefinition.body)
|
std::move(_functionDefinition.body)
|
||||||
});
|
});
|
||||||
// Generate new names for the arguments to maintain disambiguation.
|
// Generate new names for the arguments to maintain disambiguation.
|
||||||
std::map<YulString, YulString> newArgumentNames;
|
std::map<YulString, YulString> newArgumentNames;
|
||||||
@ -165,7 +165,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition)
|
|||||||
for (auto& parameter: _functionDefinition.parameters)
|
for (auto& parameter: _functionDefinition.parameters)
|
||||||
parameter.name = util::valueOrDefault(newArgumentNames, parameter.name, parameter.name);
|
parameter.name = util::valueOrDefault(newArgumentNames, parameter.name, parameter.name);
|
||||||
// Replace original function by a call to the new function and an assignment to the return variable from memory.
|
// Replace original function by a call to the new function and an assignment to the return variable from memory.
|
||||||
_functionDefinition.body = Block{_functionDefinition.debugData, move(memoryVariableInits)};
|
_functionDefinition.body = Block{_functionDefinition.debugData, std::move(memoryVariableInits)};
|
||||||
_functionDefinition.body.statements.emplace_back(ExpressionStatement{
|
_functionDefinition.body.statements.emplace_back(ExpressionStatement{
|
||||||
_functionDefinition.debugData,
|
_functionDefinition.debugData,
|
||||||
FunctionCall{
|
FunctionCall{
|
||||||
@ -189,7 +189,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!memoryVariableInits.empty())
|
if (!memoryVariableInits.empty())
|
||||||
_functionDefinition.body.statements = move(memoryVariableInits) + move(_functionDefinition.body.statements);
|
_functionDefinition.body.statements = std::move(memoryVariableInits) + std::move(_functionDefinition.body.statements);
|
||||||
|
|
||||||
_functionDefinition.returnVariables = _functionDefinition.returnVariables | ranges::views::filter(
|
_functionDefinition.returnVariables = _functionDefinition.returnVariables | ranges::views::filter(
|
||||||
not_fn(m_memoryOffsetTracker)
|
not_fn(m_memoryOffsetTracker)
|
||||||
@ -214,7 +214,7 @@ void StackToMemoryMover::operator()(Block& _block)
|
|||||||
m_context.dialect,
|
m_context.dialect,
|
||||||
debugData,
|
debugData,
|
||||||
*offset,
|
*offset,
|
||||||
_stmt.value ? *move(_stmt.value) : Literal{debugData, LiteralKind::Number, "0"_yulstring, {}}
|
_stmt.value ? *std::move(_stmt.value) : Literal{debugData, LiteralKind::Number, "0"_yulstring, {}}
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
return {};
|
return {};
|
||||||
@ -245,7 +245,7 @@ void StackToMemoryMover::operator()(Block& _block)
|
|||||||
|
|
||||||
vector<Statement> memoryAssignments;
|
vector<Statement> memoryAssignments;
|
||||||
vector<Statement> variableAssignments;
|
vector<Statement> variableAssignments;
|
||||||
VariableDeclaration tempDecl{debugData, {}, move(_stmt.value)};
|
VariableDeclaration tempDecl{debugData, {}, std::move(_stmt.value)};
|
||||||
|
|
||||||
yulAssert(rhsMemorySlots.size() == _lhsVars.size(), "");
|
yulAssert(rhsMemorySlots.size() == _lhsVars.size(), "");
|
||||||
for (auto&& [lhsVar, rhsSlot]: ranges::views::zip(_lhsVars, rhsMemorySlots))
|
for (auto&& [lhsVar, rhsSlot]: ranges::views::zip(_lhsVars, rhsMemorySlots))
|
||||||
@ -265,26 +265,26 @@ void StackToMemoryMover::operator()(Block& _block)
|
|||||||
m_context.dialect,
|
m_context.dialect,
|
||||||
_stmt.debugData,
|
_stmt.debugData,
|
||||||
*offset,
|
*offset,
|
||||||
move(*rhs)
|
std::move(*rhs)
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
variableAssignments.emplace_back(StatementType{
|
variableAssignments.emplace_back(StatementType{
|
||||||
debugData,
|
debugData,
|
||||||
{ move(lhsVar) },
|
{ std::move(lhsVar) },
|
||||||
move(rhs)
|
std::move(rhs)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<Statement> result;
|
vector<Statement> result;
|
||||||
if (tempDecl.variables.empty())
|
if (tempDecl.variables.empty())
|
||||||
result.emplace_back(ExpressionStatement{debugData, *move(tempDecl.value)});
|
result.emplace_back(ExpressionStatement{debugData, *std::move(tempDecl.value)});
|
||||||
else
|
else
|
||||||
result.emplace_back(move(tempDecl));
|
result.emplace_back(std::move(tempDecl));
|
||||||
reverse(memoryAssignments.begin(), memoryAssignments.end());
|
reverse(memoryAssignments.begin(), memoryAssignments.end());
|
||||||
result += move(memoryAssignments);
|
result += std::move(memoryAssignments);
|
||||||
reverse(variableAssignments.begin(), variableAssignments.end());
|
reverse(variableAssignments.begin(), variableAssignments.end());
|
||||||
result += move(variableAssignments);
|
result += std::move(variableAssignments);
|
||||||
return OptionalStatements{move(result)};
|
return OptionalStatements{std::move(result)};
|
||||||
};
|
};
|
||||||
|
|
||||||
util::iterateReplacing(
|
util::iterateReplacing(
|
||||||
|
@ -118,7 +118,7 @@ void UnusedFunctionParameterPruner::run(OptimiserStepContext& _context, Block& _
|
|||||||
originalFunction.returnVariables =
|
originalFunction.returnVariables =
|
||||||
filter(originalFunction.returnVariables, used.second);
|
filter(originalFunction.returnVariables, used.second);
|
||||||
|
|
||||||
return make_vector<Statement>(move(originalFunction), move(linkingFunction));
|
return make_vector<Statement>(std::move(originalFunction), std::move(linkingFunction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ void UnusedStoreBase::operator()(If const& _if)
|
|||||||
TrackedStores skipBranch{m_stores};
|
TrackedStores skipBranch{m_stores};
|
||||||
(*this)(_if.body);
|
(*this)(_if.body);
|
||||||
|
|
||||||
merge(m_stores, move(skipBranch));
|
merge(m_stores, std::move(skipBranch));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnusedStoreBase::operator()(Switch const& _switch)
|
void UnusedStoreBase::operator()(Switch const& _switch)
|
||||||
@ -56,17 +56,17 @@ void UnusedStoreBase::operator()(Switch const& _switch)
|
|||||||
if (!c.value)
|
if (!c.value)
|
||||||
hasDefault = true;
|
hasDefault = true;
|
||||||
(*this)(c.body);
|
(*this)(c.body);
|
||||||
branches.emplace_back(move(m_stores));
|
branches.emplace_back(std::move(m_stores));
|
||||||
m_stores = preState;
|
m_stores = preState;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasDefault)
|
if (hasDefault)
|
||||||
{
|
{
|
||||||
m_stores = move(branches.back());
|
m_stores = std::move(branches.back());
|
||||||
branches.pop_back();
|
branches.pop_back();
|
||||||
}
|
}
|
||||||
for (auto& branch: branches)
|
for (auto& branch: branches)
|
||||||
merge(m_stores, move(branch));
|
merge(m_stores, std::move(branch));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnusedStoreBase::operator()(FunctionDefinition const& _functionDefinition)
|
void UnusedStoreBase::operator()(FunctionDefinition const& _functionDefinition)
|
||||||
@ -97,7 +97,7 @@ void UnusedStoreBase::operator()(ForLoop const& _forLoop)
|
|||||||
TrackedStores zeroRuns{m_stores};
|
TrackedStores zeroRuns{m_stores};
|
||||||
|
|
||||||
(*this)(_forLoop.body);
|
(*this)(_forLoop.body);
|
||||||
merge(m_stores, move(m_forLoopInfo.pendingContinueStmts));
|
merge(m_stores, std::move(m_forLoopInfo.pendingContinueStmts));
|
||||||
m_forLoopInfo.pendingContinueStmts = {};
|
m_forLoopInfo.pendingContinueStmts = {};
|
||||||
(*this)(_forLoop.post);
|
(*this)(_forLoop.post);
|
||||||
|
|
||||||
@ -110,50 +110,50 @@ void UnusedStoreBase::operator()(ForLoop const& _forLoop)
|
|||||||
|
|
||||||
(*this)(_forLoop.body);
|
(*this)(_forLoop.body);
|
||||||
|
|
||||||
merge(m_stores, move(m_forLoopInfo.pendingContinueStmts));
|
merge(m_stores, std::move(m_forLoopInfo.pendingContinueStmts));
|
||||||
m_forLoopInfo.pendingContinueStmts.clear();
|
m_forLoopInfo.pendingContinueStmts.clear();
|
||||||
(*this)(_forLoop.post);
|
(*this)(_forLoop.post);
|
||||||
|
|
||||||
visit(*_forLoop.condition);
|
visit(*_forLoop.condition);
|
||||||
// Order of merging does not matter because "max" is commutative and associative.
|
// Order of merging does not matter because "max" is commutative and associative.
|
||||||
merge(m_stores, move(oneRun));
|
merge(m_stores, std::move(oneRun));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// Shortcut to avoid horrible runtime.
|
// Shortcut to avoid horrible runtime.
|
||||||
shortcutNestedLoop(zeroRuns);
|
shortcutNestedLoop(zeroRuns);
|
||||||
|
|
||||||
// Order of merging does not matter because "max" is commutative and associative.
|
// Order of merging does not matter because "max" is commutative and associative.
|
||||||
merge(m_stores, move(zeroRuns));
|
merge(m_stores, std::move(zeroRuns));
|
||||||
merge(m_stores, move(m_forLoopInfo.pendingBreakStmts));
|
merge(m_stores, std::move(m_forLoopInfo.pendingBreakStmts));
|
||||||
m_forLoopInfo.pendingBreakStmts.clear();
|
m_forLoopInfo.pendingBreakStmts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnusedStoreBase::operator()(Break const&)
|
void UnusedStoreBase::operator()(Break const&)
|
||||||
{
|
{
|
||||||
m_forLoopInfo.pendingBreakStmts.emplace_back(move(m_stores));
|
m_forLoopInfo.pendingBreakStmts.emplace_back(std::move(m_stores));
|
||||||
m_stores.clear();
|
m_stores.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnusedStoreBase::operator()(Continue const&)
|
void UnusedStoreBase::operator()(Continue const&)
|
||||||
{
|
{
|
||||||
m_forLoopInfo.pendingContinueStmts.emplace_back(move(m_stores));
|
m_forLoopInfo.pendingContinueStmts.emplace_back(std::move(m_stores));
|
||||||
m_stores.clear();
|
m_stores.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnusedStoreBase::merge(TrackedStores& _target, TrackedStores&& _other)
|
void UnusedStoreBase::merge(TrackedStores& _target, TrackedStores&& _other)
|
||||||
{
|
{
|
||||||
util::joinMap(_target, move(_other), [](
|
util::joinMap(_target, std::move(_other), [](
|
||||||
map<Statement const*, State>& _assignmentHere,
|
map<Statement const*, State>& _assignmentHere,
|
||||||
map<Statement const*, State>&& _assignmentThere
|
map<Statement const*, State>&& _assignmentThere
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return util::joinMap(_assignmentHere, move(_assignmentThere), State::join);
|
return util::joinMap(_assignmentHere, std::move(_assignmentThere), State::join);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnusedStoreBase::merge(TrackedStores& _target, vector<TrackedStores>&& _source)
|
void UnusedStoreBase::merge(TrackedStores& _target, vector<TrackedStores>&& _source)
|
||||||
{
|
{
|
||||||
for (TrackedStores& ts: _source)
|
for (TrackedStores& ts: _source)
|
||||||
merge(_target, move(ts));
|
merge(_target, std::move(ts));
|
||||||
_source.clear();
|
_source.clear();
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ void UnusedStoreEliminator::visit(Statement const& _statement)
|
|||||||
m_stores[YulString{}].insert({&_statement, initialState});
|
m_stores[YulString{}].insert({&_statement, initialState});
|
||||||
vector<Operation> operations = operationsFromFunctionCall(*funCall);
|
vector<Operation> operations = operationsFromFunctionCall(*funCall);
|
||||||
yulAssert(operations.size() == 1, "");
|
yulAssert(operations.size() == 1, "");
|
||||||
m_storeOperations[&_statement] = move(operations.front());
|
m_storeOperations[&_statement] = std::move(operations.front());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,10 +245,10 @@ vector<SyntaxTestError> CommonSyntaxTest::parseExpectations(istream& _stream)
|
|||||||
|
|
||||||
string errorMessage(it, line.end());
|
string errorMessage(it, line.end());
|
||||||
expectations.emplace_back(SyntaxTestError{
|
expectations.emplace_back(SyntaxTestError{
|
||||||
move(errorType),
|
std::move(errorType),
|
||||||
move(errorId),
|
std::move(errorId),
|
||||||
move(errorMessage),
|
std::move(errorMessage),
|
||||||
move(sourceName),
|
std::move(sourceName),
|
||||||
locationStart,
|
locationStart,
|
||||||
locationEnd
|
locationEnd
|
||||||
});
|
});
|
||||||
|
@ -50,7 +50,7 @@ evmc::VM& EVMHost::getVM(string const& _path)
|
|||||||
if (vm && errorCode == EVMC_LOADER_SUCCESS)
|
if (vm && errorCode == EVMC_LOADER_SUCCESS)
|
||||||
{
|
{
|
||||||
if (vm.get_capabilities() & (EVMC_CAPABILITY_EVM1 | EVMC_CAPABILITY_EWASM))
|
if (vm.get_capabilities() & (EVMC_CAPABILITY_EVM1 | EVMC_CAPABILITY_EWASM))
|
||||||
vms[_path] = make_unique<evmc::VM>(evmc::VM(move(vm)));
|
vms[_path] = make_unique<evmc::VM>(evmc::VM(std::move(vm)));
|
||||||
else
|
else
|
||||||
cerr << "VM loaded neither supports EVM1 nor EWASM" << endl;
|
cerr << "VM loaded neither supports EVM1 nor EWASM" << endl;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ std::optional<map<string, string>> parseCBORMetadata(bytes const& _metadata)
|
|||||||
{
|
{
|
||||||
string key = parser.readKey();
|
string key = parser.readKey();
|
||||||
string value = parser.readValue();
|
string value = parser.readValue();
|
||||||
ret[move(key)] = move(value);
|
ret[std::move(key)] = std::move(value);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ pair<SourceMap, size_t> TestCaseReader::parseSourcesAndSettingsWithLineNumber(is
|
|||||||
}
|
}
|
||||||
// Register the last source as the main one
|
// Register the last source as the main one
|
||||||
sources[currentSourceName] = currentSource;
|
sources[currentSourceName] = currentSource;
|
||||||
return {{move(sources), move(externalSources), move(currentSourceName)}, lineNumber};
|
return {{std::move(sources), std::move(externalSources), std::move(currentSourceName)}, lineNumber};
|
||||||
}
|
}
|
||||||
|
|
||||||
string TestCaseReader::parseSimpleExpectations(istream& _file)
|
string TestCaseReader::parseSimpleExpectations(istream& _file)
|
||||||
|
@ -143,7 +143,7 @@ namespace
|
|||||||
for (BasicBlock const& block: cfg.optimisedBlocks())
|
for (BasicBlock const& block: cfg.optimisedBlocks())
|
||||||
copy(output.begin() + static_cast<int>(block.begin), output.begin() + static_cast<int>(block.end),
|
copy(output.begin() + static_cast<int>(block.begin), output.begin() + static_cast<int>(block.end),
|
||||||
back_inserter(optItems));
|
back_inserter(optItems));
|
||||||
output = move(optItems);
|
output = std::move(optItems);
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -150,11 +150,11 @@ struct TestScanner
|
|||||||
{
|
{
|
||||||
unique_ptr<CharStream> stream;
|
unique_ptr<CharStream> stream;
|
||||||
unique_ptr<Scanner> scanner;
|
unique_ptr<Scanner> scanner;
|
||||||
explicit TestScanner(string _text) { reset(move(_text)); }
|
explicit TestScanner(string _text) { reset(std::move(_text)); }
|
||||||
|
|
||||||
void reset(std::string _text)
|
void reset(std::string _text)
|
||||||
{
|
{
|
||||||
stream = make_unique<CharStream>(move(_text), "");
|
stream = make_unique<CharStream>(std::move(_text), "");
|
||||||
scanner = make_unique<Scanner>(*stream);
|
scanner = make_unique<Scanner>(*stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void GasTest::parseExpectations(std::istream& _stream)
|
|||||||
{
|
{
|
||||||
string kind = line.substr(3, line.length() - 4);
|
string kind = line.substr(3, line.length() - 4);
|
||||||
boost::trim(kind);
|
boost::trim(kind);
|
||||||
currentKind = &m_expectations[move(kind)];
|
currentKind = &m_expectations[std::move(kind)];
|
||||||
}
|
}
|
||||||
else if (!currentKind)
|
else if (!currentKind)
|
||||||
BOOST_THROW_EXCEPTION(runtime_error("No function kind specified. Expected \"creation:\", \"external:\" or \"internal:\"."));
|
BOOST_THROW_EXCEPTION(runtime_error("No function kind specified. Expected \"creation:\", \"external:\" or \"internal:\"."));
|
||||||
|
@ -77,7 +77,7 @@ SMTCheckerTest::SMTCheckerTest(string const& _filename): SyntaxTest(_filename, E
|
|||||||
return filtered;
|
return filtered;
|
||||||
};
|
};
|
||||||
if (m_modelCheckerSettings.invariants.invariants.empty())
|
if (m_modelCheckerSettings.invariants.invariants.empty())
|
||||||
m_expectations = removeInv(move(m_expectations));
|
m_expectations = removeInv(std::move(m_expectations));
|
||||||
|
|
||||||
auto const& ignoreInv = m_reader.stringSetting("SMTIgnoreInv", "yes");
|
auto const& ignoreInv = m_reader.stringSetting("SMTIgnoreInv", "yes");
|
||||||
if (ignoreInv == "no")
|
if (ignoreInv == "no")
|
||||||
|
@ -61,7 +61,7 @@ SemanticTest::SemanticTest(
|
|||||||
m_sideEffectHooks(makeSideEffectHooks()),
|
m_sideEffectHooks(makeSideEffectHooks()),
|
||||||
m_enforceCompileToEwasm(_enforceCompileToEwasm),
|
m_enforceCompileToEwasm(_enforceCompileToEwasm),
|
||||||
m_enforceGasCost(_enforceGasCost),
|
m_enforceGasCost(_enforceGasCost),
|
||||||
m_enforceGasCostMinValue(move(_enforceGasCostMinValue))
|
m_enforceGasCostMinValue(std::move(_enforceGasCostMinValue))
|
||||||
{
|
{
|
||||||
static set<string> const compileViaYulAllowedValues{"also", "true", "false"};
|
static set<string> const compileViaYulAllowedValues{"also", "true", "false"};
|
||||||
static set<string> const yulRunTriggers{"also", "true"};
|
static set<string> const yulRunTriggers{"also", "true"};
|
||||||
@ -457,14 +457,14 @@ TestCase::TestResult SemanticTest::runTest(
|
|||||||
success = false;
|
success = false;
|
||||||
|
|
||||||
test.setFailure(!m_transactionSuccessful);
|
test.setFailure(!m_transactionSuccessful);
|
||||||
test.setRawBytes(move(output));
|
test.setRawBytes(std::move(output));
|
||||||
test.setContractABI(m_compiler.contractABI(m_compiler.lastContractName(m_sources.mainSourceFile)));
|
test.setContractABI(m_compiler.contractABI(m_compiler.lastContractName(m_sources.mainSourceFile)));
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<string> effects;
|
vector<string> effects;
|
||||||
for (SideEffectHook const& hook: m_sideEffectHooks)
|
for (SideEffectHook const& hook: m_sideEffectHooks)
|
||||||
effects += hook(test.call());
|
effects += hook(test.call());
|
||||||
test.setSideEffects(move(effects));
|
test.setSideEffects(std::move(effects));
|
||||||
|
|
||||||
success &= test.call().expectedSideEffects == test.call().actualSideEffects;
|
success &= test.call().expectedSideEffects == test.call().actualSideEffects;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ bytes SolidityExecutionFramework::multiSourceCompileContract(
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
asmStack.optimize();
|
asmStack.optimize();
|
||||||
obj = move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode);
|
obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode);
|
||||||
obj.link(_libraryAddresses);
|
obj.link(_libraryAddresses);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ vector<solidity::frontend::test::FunctionCall> TestFileParser::parseFunctionCall
|
|||||||
accept(Token::Newline, true);
|
accept(Token::Newline, true);
|
||||||
call.expectedSideEffects = parseFunctionCallSideEffects();
|
call.expectedSideEffects = parseFunctionCallSideEffects();
|
||||||
|
|
||||||
calls.emplace_back(move(call));
|
calls.emplace_back(std::move(call));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (TestParserError const& _e)
|
catch (TestParserError const& _e)
|
||||||
|
@ -122,7 +122,7 @@ tuple<optional<SourceNameMap>, ErrorList> tryGetSourceLocationMapping(string _so
|
|||||||
ErrorReporter reporter(errors);
|
ErrorReporter reporter(errors);
|
||||||
Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(EVMVersion::berlin());
|
Dialect const& dialect = yul::EVMDialect::strictAssemblyForEVM(EVMVersion::berlin());
|
||||||
ObjectParser objectParser{reporter, dialect};
|
ObjectParser objectParser{reporter, dialect};
|
||||||
CharStream stream(move(source), "");
|
CharStream stream(std::move(source), "");
|
||||||
auto object = objectParser.parse(make_shared<Scanner>(stream), false);
|
auto object = objectParser.parse(make_shared<Scanner>(stream), false);
|
||||||
BOOST_REQUIRE(object && object->debugData);
|
BOOST_REQUIRE(object && object->debugData);
|
||||||
return {object->debugData->sourceNames, std::move(errors)};
|
return {object->debugData->sourceNames, std::move(errors)};
|
||||||
|
@ -65,7 +65,7 @@ shared_ptr<Block> parse(string const& _source, Dialect const& _dialect, ErrorRep
|
|||||||
auto parserResult = yul::Parser(
|
auto parserResult = yul::Parser(
|
||||||
errorReporter,
|
errorReporter,
|
||||||
_dialect,
|
_dialect,
|
||||||
move(indicesToSourceNames)
|
std::move(indicesToSourceNames)
|
||||||
).parse(stream);
|
).parse(stream);
|
||||||
if (parserResult)
|
if (parserResult)
|
||||||
{
|
{
|
||||||
|
@ -91,5 +91,5 @@ string test::stripPreReleaseWarning(string const& _stderrContent)
|
|||||||
};
|
};
|
||||||
|
|
||||||
string output = regex_replace(_stderrContent, preReleaseWarningRegex, "");
|
string output = regex_replace(_stderrContent, preReleaseWarningRegex, "");
|
||||||
return regex_replace(move(output), noOutputRegex, "");
|
return regex_replace(std::move(output), noOutputRegex, "");
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user