mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into breaking
This commit is contained in:
@@ -309,6 +309,7 @@ vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
|
||||
literalArguments = &f->literalArguments;
|
||||
|
||||
validateInstructions(_funCall);
|
||||
m_sideEffects += f->sideEffects;
|
||||
}
|
||||
else if (!m_currentScope->lookup(_funCall.functionName.name, GenericVisitor{
|
||||
[&](Scope::Variable const&)
|
||||
|
||||
@@ -94,6 +94,8 @@ public:
|
||||
void operator()(Leave const&) { }
|
||||
void operator()(Block const& _block);
|
||||
|
||||
/// @returns the worst side effects encountered during analysis (including within defined functions).
|
||||
SideEffects const& sideEffects() const { return m_sideEffects; }
|
||||
private:
|
||||
/// Visits the expression, expects that it evaluates to exactly one value and
|
||||
/// returns the type. Reports errors on errors and returns the default type.
|
||||
@@ -128,6 +130,8 @@ private:
|
||||
/// Names of data objects to be referenced by builtin functions with literal arguments.
|
||||
std::set<YulString> m_dataNames;
|
||||
ForLoop const* m_currentForLoop = nullptr;
|
||||
/// Worst side effects encountered during analysis (including within defined functions).
|
||||
SideEffects m_sideEffects;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <libyul/optimiser/ASTWalker.h>
|
||||
#include <liblangutil/EVMVersion.h>
|
||||
#include <libsolutil/Numeric.h>
|
||||
#include <libevmasm/Instruction.h>
|
||||
|
||||
namespace solidity::yul
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <libyul/backends/evm/EVMDialect.h>
|
||||
#include <libyul/backends/evm/OptimizedEVMCodeTransform.h>
|
||||
|
||||
#include <libyul/optimiser/FunctionCallFinder.h>
|
||||
|
||||
#include <libyul/Object.h>
|
||||
#include <libyul/Exceptions.h>
|
||||
|
||||
@@ -74,7 +76,22 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize)
|
||||
OptimizedEVMCodeTransform::UseNamedLabels::ForFirstFunctionOfEachName
|
||||
);
|
||||
if (!stackErrors.empty())
|
||||
BOOST_THROW_EXCEPTION(stackErrors.front());
|
||||
{
|
||||
vector<FunctionCall*> memoryGuardCalls = FunctionCallFinder::run(
|
||||
*_object.code,
|
||||
"memoryguard"_yulstring
|
||||
);
|
||||
auto stackError = stackErrors.front();
|
||||
string msg = stackError.comment() ? *stackError.comment() : "";
|
||||
if (memoryGuardCalls.empty())
|
||||
msg += "\nNo memoryguard was present. "
|
||||
"Consider using memory-safe assembly only and annotating it via "
|
||||
"\"/// @solidity memory-safe-assembly\".";
|
||||
else
|
||||
msg += "\nmemoryguard was present.";
|
||||
stackError << util::errinfo_comment(msg);
|
||||
BOOST_THROW_EXCEPTION(stackError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <libyul/YulString.h>
|
||||
|
||||
#include <libsolutil/CommonData.h>
|
||||
#include <libsolutil/Numeric.h>
|
||||
|
||||
#include <liblangutil/EVMVersion.h>
|
||||
#include <liblangutil/SourceLocation.h>
|
||||
|
||||
@@ -73,6 +73,7 @@ void UnusedStoreBase::operator()(FunctionDefinition const& _functionDefinition)
|
||||
{
|
||||
ScopedSaveAndRestore outerAssignments(m_stores, {});
|
||||
ScopedSaveAndRestore forLoopInfo(m_forLoopInfo, {});
|
||||
ScopedSaveAndRestore forLoopNestingDepth(m_forLoopNestingDepth, 0);
|
||||
|
||||
(*this)(_functionDefinition.body);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user