spirv-fuzz: Quit fuzzer pass when no types are available (#4409)

The fuzzer pass that adds global variables requires some basic
types. This change makes the fuzzer pass exit gracefully when none are
available.

Fixes #4408.
This commit is contained in:
Alastair Donaldson 2021-07-28 22:59:02 +01:00 committed by GitHub
parent 4bcd13ff13
commit c9e094cc4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,10 @@ void FuzzerPassAddGlobalVariables::Apply() {
// These are the basic types that are available to this fuzzer pass.
auto& basic_types = basic_type_ids_and_pointers.first;
if (basic_types.empty()) {
// There are no basic types, so there is nothing this fuzzer pass can do.
return;
}
// These are the pointers to those basic types that are *initially* available
// to the fuzzer pass. The fuzzer pass might add pointer types in cases where