File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
test/tools/ossfuzz/protomutators Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ static addControlFlow<SwitchStmt> c4;
73
73
static addControlFlow<FunctionDef> c5;
74
74
static addControlFlow<CaseStmt> c6;
75
75
static addControlFlow<Code> c7;
76
+ static addControlFlow<Program> c8;
76
77
77
78
Literal* YPM::intLiteral (unsigned _value)
78
79
{
@@ -261,6 +262,24 @@ Block* YPM::basicBlock(T* _msg)
261
262
return _msg->mutable_case_block ();
262
263
else if constexpr (std::is_same_v<T, Code>)
263
264
return _msg->mutable_block ();
265
+ else if constexpr (std::is_same_v<T, Program>)
266
+ return globalBlock (_msg);
264
267
else
265
268
static_assert (AlwaysFalse<T>::value, " Yul proto mutator: non-exhaustive visitor." );
266
269
}
270
+
271
+ Block* YPM::globalBlock (Program* _program)
272
+ {
273
+ switch (_program->program_oneof_case ())
274
+ {
275
+ case Program::kBlock :
276
+ return _program->mutable_block ();
277
+ case Program::kObj :
278
+ return _program->mutable_obj ()->mutable_code ()->mutable_block ();
279
+ case Program::PROGRAM_ONEOF_NOT_SET:
280
+ {
281
+ _program->set_allocated_block (new Block ());
282
+ return _program->mutable_block ();
283
+ }
284
+ }
285
+ }
Original file line number Diff line number Diff line change @@ -103,5 +103,7 @@ struct YulProtoMutator
103
103
// / Obtain a basic block in a for stmt uniformly
104
104
// / at random
105
105
static Block* randomBlock (ForStmt* _msg);
106
+ // / Obtain a basic block in global scope.
107
+ static Block* globalBlock (Program* _program);
106
108
};
107
109
}
You can’t perform that action at this time.
0 commit comments