From 5693637faa4711b61dd8a1c5bc1f2bd48927673b Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 29 Dec 2015 16:57:21 -0800 Subject: [PATCH] nir/print: Handle variables with var->name == NULL --- src/glsl/nir/nir_print.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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); -- 2.30.2