fuzz_with_unicorn: Move instruction generator vector into GenRandomInst

Keeps scope localized and prevents potential static initialization issues.
This commit is contained in:
Lioncash 2018-02-04 14:33:34 -05:00 committed by MerryMage
parent 4491746eae
commit f96e83c486

View file

@ -31,7 +31,8 @@ static Vector RandomVector() {
return {RandInt<u64>(0, ~u64(0)), RandInt<u64>(0, ~u64(0))}; return {RandInt<u64>(0, ~u64(0)), RandInt<u64>(0, ~u64(0))};
} }
static std::vector<InstructionGenerator> instruction_generators = []{ static u32 GenRandomInst(u64 pc, bool is_last_inst) {
static const std::vector<InstructionGenerator> instruction_generators = []{
const std::vector<std::tuple<const char*, const char*>> list { const std::vector<std::tuple<const char*, const char*>> list {
#define INST(fn, name, bitstring) {#fn, bitstring}, #define INST(fn, name, bitstring) {#fn, bitstring},
#include "frontend/A64/decoder/a64.inc" #include "frontend/A64/decoder/a64.inc"
@ -55,7 +56,6 @@ static std::vector<InstructionGenerator> instruction_generators = []{
return result; return result;
}(); }();
static u32 GenRandomInst(u64 pc, bool is_last_inst) {
const A64::LocationDescriptor location{pc, {}}; const A64::LocationDescriptor location{pc, {}};
restart: restart: