spirv-fuzz: refactor to use RemoveAtRandomIndex (#3560)

Make the code in fuzzer_pass_merge_blocks.cpp simpler by
using the RemoveAtRandomIndex function from FuzzerContext.

See related comment in #3540
This commit is contained in:
Stefano Milizia 2020-07-20 15:10:38 +00:00 committed by GitHub
parent 0d8fe0fba0
commit c10d6cebbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,9 +53,8 @@ void FuzzerPassMergeBlocks::Apply() {
}
while (!potential_transformations.empty()) {
uint32_t index = GetFuzzerContext()->RandomIndex(potential_transformations);
auto transformation = potential_transformations.at(index);
potential_transformations.erase(potential_transformations.begin() + index);
auto transformation =
GetFuzzerContext()->RemoveAtRandomIndex(&potential_transformations);
MaybeApplyTransformation(transformation);
}
}