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:
@@ -208,7 +208,9 @@ void IRGeneratorForStatements::initializeLocalVar(VariableDeclaration const& _va
|
||||
solAssert(m_context.isLocalVariable(_varDecl), "Must be a local variable.");
|
||||
|
||||
auto const* type = _varDecl.type();
|
||||
if (auto const* refType = dynamic_cast<ReferenceType const*>(type))
|
||||
if (dynamic_cast<MappingType const*>(type))
|
||||
return;
|
||||
else if (auto const* refType = dynamic_cast<ReferenceType const*>(type))
|
||||
if (refType->dataStoredIn(DataLocation::Storage) && refType->isPointer())
|
||||
return;
|
||||
|
||||
@@ -1356,10 +1358,13 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
datacopy(<memPos>, dataoffset("<object>"), datasize("<object>"))
|
||||
<memEnd> := <abiEncode>(<memEnd><constructorParams>)
|
||||
<?saltSet>
|
||||
let <retVars> := create2(<value>, <memPos>, sub(<memEnd>, <memPos>), <salt>)
|
||||
let <address> := create2(<value>, <memPos>, sub(<memEnd>, <memPos>), <salt>)
|
||||
<!saltSet>
|
||||
let <retVars> := create(<value>, <memPos>, sub(<memEnd>, <memPos>))
|
||||
let <address> := create(<value>, <memPos>, sub(<memEnd>, <memPos>))
|
||||
</saltSet>
|
||||
<?isTryCall>
|
||||
let <success> := iszero(iszero(<address>))
|
||||
</isTryCall>
|
||||
<releaseTemporaryMemory>()
|
||||
)");
|
||||
t("memPos", m_context.newYulVariable());
|
||||
@@ -1376,7 +1381,11 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
||||
t("saltSet", functionType->saltSet());
|
||||
if (functionType->saltSet())
|
||||
t("salt", IRVariable(_functionCall.expression()).part("salt").name());
|
||||
t("retVars", IRVariable(_functionCall).commaSeparatedList());
|
||||
solAssert(IRVariable(_functionCall).stackSlots().size() == 1, "");
|
||||
t("address", IRVariable(_functionCall).commaSeparatedList());
|
||||
t("isTryCall", _functionCall.annotation().tryCall);
|
||||
if (_functionCall.annotation().tryCall)
|
||||
t("success", IRNames::trySuccessConditionVariable(_functionCall));
|
||||
m_code << t.render();
|
||||
|
||||
break;
|
||||
@@ -1993,28 +2002,27 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
|
||||
}
|
||||
case DataLocation::CallData:
|
||||
{
|
||||
IRVariable var(m_context.newYulVariable(), *arrayType.baseType());
|
||||
define(var) <<
|
||||
m_utils.calldataArrayIndexAccessFunction(arrayType) <<
|
||||
"(" <<
|
||||
IRVariable(_indexAccess.baseExpression()).commaSeparatedList() <<
|
||||
", " <<
|
||||
expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) <<
|
||||
string const indexAccessFunctionCall =
|
||||
m_utils.calldataArrayIndexAccessFunction(arrayType) +
|
||||
"(" +
|
||||
IRVariable(_indexAccess.baseExpression()).commaSeparatedList() +
|
||||
", " +
|
||||
expressionAsType(*_indexAccess.indexExpression(), *TypeProvider::uint256()) +
|
||||
")\n";
|
||||
if (arrayType.isByteArray())
|
||||
define(_indexAccess) <<
|
||||
m_utils.cleanupFunction(*arrayType.baseType()) <<
|
||||
"(calldataload(" <<
|
||||
var.name() <<
|
||||
indexAccessFunctionCall <<
|
||||
"))\n";
|
||||
else if (arrayType.baseType()->isValueType())
|
||||
define(_indexAccess) <<
|
||||
m_utils.readFromCalldata(*arrayType.baseType()) <<
|
||||
"(" <<
|
||||
var.commaSeparatedList() <<
|
||||
indexAccessFunctionCall <<
|
||||
")\n";
|
||||
else
|
||||
define(_indexAccess, var);
|
||||
define(_indexAccess) << indexAccessFunctionCall;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
void pushSolver();
|
||||
void popSolver();
|
||||
void addAssertion(smtutil::Expression const& _e);
|
||||
unsigned solverStackHeigh() { return m_assertions.size(); } const
|
||||
size_t solverStackHeigh() { return m_assertions.size(); } const
|
||||
smtutil::SolverInterface* solver()
|
||||
{
|
||||
solAssert(m_solver, "");
|
||||
|
||||
@@ -349,7 +349,7 @@ bool Predicate::fillArray(smtutil::Expression const& _expr, vector<string>& _arr
|
||||
return false;
|
||||
// Sometimes the solver assigns huge lengths that are not related,
|
||||
// we should catch and ignore those.
|
||||
unsigned index;
|
||||
unsigned long index;
|
||||
try
|
||||
{
|
||||
index = stoul(*indexStr);
|
||||
|
||||
@@ -41,7 +41,7 @@ BlockchainVariable::BlockchainVariable(
|
||||
{
|
||||
members.emplace_back(component);
|
||||
sorts.emplace_back(sort);
|
||||
m_componentIndices[component] = members.size() - 1;
|
||||
m_componentIndices[component] = static_cast<unsigned>(members.size() - 1);
|
||||
}
|
||||
m_tuple = make_unique<SymbolicTupleVariable>(
|
||||
make_shared<smtutil::TupleSort>(m_name + "_type", members, sorts),
|
||||
|
||||
Reference in New Issue
Block a user