mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[Proto fuzzer]: Add terminating opcodes
This commit is contained in:
parent
cbc1b97760
commit
a5524983f9
@ -554,6 +554,63 @@ void ProtoConverter::visit(SwitchStmt const& _x)
|
||||
}
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(StopInvalidStmt const& _x)
|
||||
{
|
||||
switch (_x.stmt())
|
||||
{
|
||||
case StopInvalidStmt::STOP:
|
||||
m_output << "stop()\n";
|
||||
break;
|
||||
case StopInvalidStmt::INVALID:
|
||||
m_output << "invalid()\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(RetRevStmt const& _x)
|
||||
{
|
||||
switch (_x.stmt())
|
||||
{
|
||||
case RetRevStmt::RETURN:
|
||||
m_output << "return";
|
||||
break;
|
||||
case RetRevStmt::REVERT:
|
||||
m_output << "revert";
|
||||
break;
|
||||
}
|
||||
m_output << "(";
|
||||
visit(_x.pos());
|
||||
m_output << ", ";
|
||||
visit(_x.size());
|
||||
m_output << ")\n";
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(SelfDestructStmt const& _x)
|
||||
{
|
||||
m_output << "selfdestruct";
|
||||
m_output << "(";
|
||||
visit(_x.addr());
|
||||
m_output << ")\n";
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(TerminatingStmt const& _x)
|
||||
{
|
||||
switch (_x.term_oneof_case())
|
||||
{
|
||||
case TerminatingStmt::kStopInvalid:
|
||||
visit(_x.stop_invalid());
|
||||
break;
|
||||
case TerminatingStmt::kRetRev:
|
||||
visit(_x.ret_rev());
|
||||
break;
|
||||
case TerminatingStmt::kSelfDes:
|
||||
visit(_x.self_des());
|
||||
break;
|
||||
case TerminatingStmt::TERM_ONEOF_NOT_SET:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(Statement const& _x)
|
||||
{
|
||||
switch (_x.stmt_oneof_case())
|
||||
@ -596,6 +653,9 @@ void ProtoConverter::visit(Statement const& _x)
|
||||
case Statement::kExtcodeCopy:
|
||||
visit(_x.extcode_copy());
|
||||
break;
|
||||
case Statement::kTerminatestmt:
|
||||
visit(_x.terminatestmt());
|
||||
break;
|
||||
case Statement::STMT_ONEOF_NOT_SET:
|
||||
break;
|
||||
}
|
||||
|
@ -71,6 +71,10 @@ private:
|
||||
void visit(LogFunc const&);
|
||||
void visit(CopyFunc const&);
|
||||
void visit(ExtCodeCopy const&);
|
||||
void visit(StopInvalidStmt const&);
|
||||
void visit(RetRevStmt const&);
|
||||
void visit(SelfDestructStmt const&);
|
||||
void visit(TerminatingStmt const&);
|
||||
template <class T>
|
||||
void visit(google::protobuf::RepeatedPtrField<T> const& _repeated_field);
|
||||
|
||||
|
@ -223,6 +223,36 @@ message SwitchStmt {
|
||||
message BreakStmt {}
|
||||
message ContinueStmt {}
|
||||
|
||||
message StopInvalidStmt {
|
||||
enum Type {
|
||||
STOP = 0;
|
||||
INVALID = 1;
|
||||
}
|
||||
required Type stmt = 1;
|
||||
}
|
||||
|
||||
message RetRevStmt {
|
||||
enum Type {
|
||||
RETURN = 0;
|
||||
REVERT = 1;
|
||||
}
|
||||
required Type stmt = 1;
|
||||
required Expression pos = 2;
|
||||
required Expression size = 3;
|
||||
}
|
||||
|
||||
message SelfDestructStmt {
|
||||
required Expression addr = 1;
|
||||
}
|
||||
|
||||
message TerminatingStmt {
|
||||
oneof term_oneof {
|
||||
StopInvalidStmt stop_invalid = 1;
|
||||
RetRevStmt ret_rev = 2;
|
||||
SelfDestructStmt self_des = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message Statement {
|
||||
oneof stmt_oneof {
|
||||
VarDecl decl = 1;
|
||||
@ -237,6 +267,7 @@ message Statement {
|
||||
LogFunc log_func = 10;
|
||||
CopyFunc copy_func = 11;
|
||||
ExtCodeCopy extcode_copy = 12;
|
||||
TerminatingStmt terminatestmt = 13;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user