mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Changes to yul proto mutator.
This commit is contained in:
parent
cf08c9b255
commit
7c806217fb
@ -102,7 +102,15 @@ private:
|
|||||||
void visit(RetRevStmt const&);
|
void visit(RetRevStmt const&);
|
||||||
void visit(SelfDestructStmt const&);
|
void visit(SelfDestructStmt const&);
|
||||||
void visit(TerminatingStmt const&);
|
void visit(TerminatingStmt const&);
|
||||||
void visit(FunctionCall const&, std::string const&, bool _expression = false);
|
/// @param _f is the function call to be visited.
|
||||||
|
/// @param _name is the name of the function called.
|
||||||
|
/// @param _expression is a flag that is true if the function is called
|
||||||
|
/// as a single-value expression, false otherwise.
|
||||||
|
void visit(
|
||||||
|
FunctionCall const& _f,
|
||||||
|
std::string const& _name,
|
||||||
|
bool _expression = false
|
||||||
|
);
|
||||||
void visit(FunctionDef const&);
|
void visit(FunctionDef const&);
|
||||||
void visit(PopStmt const&);
|
void visit(PopStmt const&);
|
||||||
void visit(LeaveStmt const&);
|
void visit(LeaveStmt const&);
|
||||||
|
@ -107,9 +107,7 @@ template <typename T>
|
|||||||
T YPM::EnumTypeConverter<T>::validEnum(unsigned _seed)
|
T YPM::EnumTypeConverter<T>::validEnum(unsigned _seed)
|
||||||
{
|
{
|
||||||
auto ret = static_cast<T>(_seed % (enumMax() - enumMin() + 1) + enumMin());
|
auto ret = static_cast<T>(_seed % (enumMax() - enumMin() + 1) + enumMin());
|
||||||
if constexpr (std::is_same_v<std::decay_t<T>, FunctionCall_Returns>)
|
if constexpr (std::is_same_v<std::decay_t<T>, StoreFunc_Storage>)
|
||||||
yulAssert(FunctionCall_Returns_IsValid(ret), "Yul proto mutator: Invalid enum");
|
|
||||||
else if constexpr (std::is_same_v<std::decay_t<T>, StoreFunc_Storage>)
|
|
||||||
yulAssert(StoreFunc_Storage_IsValid(ret), "Yul proto mutator: Invalid enum");
|
yulAssert(StoreFunc_Storage_IsValid(ret), "Yul proto mutator: Invalid enum");
|
||||||
else if constexpr (std::is_same_v<std::decay_t<T>, NullaryOp_NOp>)
|
else if constexpr (std::is_same_v<std::decay_t<T>, NullaryOp_NOp>)
|
||||||
yulAssert(NullaryOp_NOp_IsValid(ret), "Yul proto mutator: Invalid enum");
|
yulAssert(NullaryOp_NOp_IsValid(ret), "Yul proto mutator: Invalid enum");
|
||||||
@ -131,9 +129,7 @@ T YPM::EnumTypeConverter<T>::validEnum(unsigned _seed)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
unsigned YPM::EnumTypeConverter<T>::enumMax()
|
unsigned YPM::EnumTypeConverter<T>::enumMax()
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<std::decay_t<T>, FunctionCall_Returns>)
|
if constexpr (std::is_same_v<std::decay_t<T>, StoreFunc_Storage>)
|
||||||
return FunctionCall_Returns_Returns_MAX;
|
|
||||||
else if constexpr (std::is_same_v<std::decay_t<T>, StoreFunc_Storage>)
|
|
||||||
return StoreFunc_Storage_Storage_MAX;
|
return StoreFunc_Storage_Storage_MAX;
|
||||||
else if constexpr (std::is_same_v<std::decay_t<T>, NullaryOp_NOp>)
|
else if constexpr (std::is_same_v<std::decay_t<T>, NullaryOp_NOp>)
|
||||||
return NullaryOp_NOp_NOp_MAX;
|
return NullaryOp_NOp_NOp_MAX;
|
||||||
@ -154,9 +150,7 @@ unsigned YPM::EnumTypeConverter<T>::enumMax()
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
unsigned YPM::EnumTypeConverter<T>::enumMin()
|
unsigned YPM::EnumTypeConverter<T>::enumMin()
|
||||||
{
|
{
|
||||||
if constexpr (std::is_same_v<std::decay_t<T>, FunctionCall_Returns>)
|
if constexpr (std::is_same_v<std::decay_t<T>, StoreFunc_Storage>)
|
||||||
return FunctionCall_Returns_Returns_MIN;
|
|
||||||
else if constexpr (std::is_same_v<std::decay_t<T>, StoreFunc_Storage>)
|
|
||||||
return StoreFunc_Storage_Storage_MIN;
|
return StoreFunc_Storage_Storage_MIN;
|
||||||
else if constexpr (std::is_same_v<std::decay_t<T>, NullaryOp_NOp>)
|
else if constexpr (std::is_same_v<std::decay_t<T>, NullaryOp_NOp>)
|
||||||
return NullaryOp_NOp_NOp_MIN;
|
return NullaryOp_NOp_NOp_MIN;
|
||||||
|
Loading…
Reference in New Issue
Block a user