mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Swap mutated block and function def block
This commit is contained in:
parent
2c48f9a841
commit
145a4ee645
@ -666,8 +666,13 @@ static YulProtoMutator addFuncDef(
|
|||||||
std::cout << "YULMUTATOR: Add function def" << std::endl;
|
std::cout << "YULMUTATOR: Add function def" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
auto block = static_cast<Block*>(_message);
|
auto block = static_cast<Block*>(_message);
|
||||||
auto stmt = block->add_statements();
|
|
||||||
auto funcDef = new FunctionDef();
|
auto funcDef = new FunctionDef();
|
||||||
|
funcDef->set_num_input_params(_seed);
|
||||||
|
funcDef->set_num_output_params(_seed + block->ByteSizeLong());
|
||||||
|
funcDef->mutable_block()->Swap(block);
|
||||||
|
// block should be empty now since it has been swapped
|
||||||
|
// with a default instance of function definition block.
|
||||||
|
auto stmt = block->add_statements();
|
||||||
stmt->set_allocated_funcdef(funcDef);
|
stmt->set_allocated_funcdef(funcDef);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
std::cout << protobuf_mutator::SaveMessageAsText(*_message) << std::endl;
|
std::cout << protobuf_mutator::SaveMessageAsText(*_message) << std::endl;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user