mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6554 from ethereum/add-ternary-ops
ossfuzz: Generate addmod and mulmod builtin functions
This commit is contained in:
commit
1d5559c350
@ -307,6 +307,26 @@ void ProtoConverter::visit(UnaryOp const& _x)
|
||||
m_output << ")";
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(TernaryOp const& _x)
|
||||
{
|
||||
switch (_x.op())
|
||||
{
|
||||
case TernaryOp::ADDM:
|
||||
m_output << "addmod";
|
||||
break;
|
||||
case TernaryOp::MULM:
|
||||
m_output << "mulmod";
|
||||
break;
|
||||
}
|
||||
m_output << "(";
|
||||
visit(_x.arg1());
|
||||
m_output << ", ";
|
||||
visit(_x.arg2());
|
||||
m_output << ", ";
|
||||
visit(_x.arg3());
|
||||
m_output << ")";
|
||||
}
|
||||
|
||||
void ProtoConverter::visit(AssignmentStatement const& _x)
|
||||
{
|
||||
visit(_x.ref_id());
|
||||
|
@ -66,6 +66,7 @@ private:
|
||||
void visit(ForStmt const&);
|
||||
void visit(CaseStmt const&);
|
||||
void visit(SwitchStmt const&);
|
||||
void visit(TernaryOp const&);
|
||||
template <class T>
|
||||
void visit(google::protobuf::RepeatedPtrField<T> const& _repeated_field);
|
||||
|
||||
|
@ -111,6 +111,17 @@ message UnaryOp {
|
||||
required Expression operand = 2;
|
||||
}
|
||||
|
||||
message TernaryOp {
|
||||
enum TOp {
|
||||
ADDM = 0;
|
||||
MULM = 1;
|
||||
}
|
||||
required TOp op = 1;
|
||||
required Expression arg1 = 2;
|
||||
required Expression arg2 = 3;
|
||||
required Expression arg3 = 4;
|
||||
}
|
||||
|
||||
message StoreFunc {
|
||||
enum Storage {
|
||||
MSTORE = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user