nir: don't segfault when printing variables with no name
authorConnor Abbott <cwabbott0@gmail.com>
Tue, 27 Jun 2017 00:07:21 +0000 (17:07 -0700)
committerConnor Abbott <cwabbott0@gmail.com>
Thu, 13 Jul 2017 21:40:23 +0000 (14:40 -0700)
commit99ff7a9f1f08b2e3687946dec09b2c010540fa1d
tree6656de7457ec5ef998b4a3eb9fac7197fc912334
parentadd72599d9aba53753a311db13332531c3635176
nir: don't segfault when printing variables with no name

While normally we give variables whose name field is NULL a temporary
name when called from nir_print_shader(), when we were calling from
nir_print_instr() we never bothered, meaning that we just segfaulted
when trying to print out instructions with such a variable. Since
nir_print_instr() is meant to be called while debugging, we don't need
to bother too much about giving a consistent name, but we don't want to
crash in the middle of debugging.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/compiler/nir/nir_print.c