From: Jason Ekstrand Date: Wed, 30 Dec 2015 00:57:21 +0000 (-0800) Subject: nir/print: Handle variables with var->name == NULL X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5693637faa4711b61dd8a1c5bc1f2bd48927673b;p=mesa.git nir/print: Handle variables with var->name == NULL --- diff --git a/src/glsl/nir/nir_print.c b/src/glsl/nir/nir_print.c index 176057ffa4b..a231494d4ad 100644 --- a/src/glsl/nir/nir_print.c +++ b/src/glsl/nir/nir_print.c @@ -232,15 +232,20 @@ get_var_name(nir_variable *var, print_state *state) return entry->data; char *name; - - struct set_entry *set_entry = _mesa_set_search(state->syms, var->name); - if (set_entry != NULL) { - /* we have a collision with another name, append an @ + a unique index */ - name = ralloc_asprintf(state->syms, "%s@%u", var->name, state->index++); + if (var->name == NULL) { + name = ralloc_asprintf(state->syms, "@%u", state->index++); } else { - /* Mark this one as seen */ - _mesa_set_add(state->syms, var->name); - name = var->name; + struct set_entry *set_entry = _mesa_set_search(state->syms, var->name); + if (set_entry != NULL) { + /* we have a collision with another name, append an @ + a unique + * index */ + name = ralloc_asprintf(state->syms, "%s@%u", var->name, + state->index++); + } else { + /* Mark this one as seen */ + _mesa_set_add(state->syms, var->name); + name = var->name; + } } _mesa_hash_table_insert(state->ht, var, name);