glsl: Move is_array_or_matrix outside visitor class
[mesa.git] / src / glsl / ir_print_visitor.cpp
index 5b5409daa222a3a3cc83e6718b4648f74ff841ad..518910bd129a1a4805607f9e7b68404b36b92a82 100644 (file)
@@ -96,6 +96,16 @@ void ir_print_visitor::indent(void)
 const char *
 ir_print_visitor::unique_name(ir_variable *var)
 {
+   /* var->name can be NULL in function prototypes when a type is given for a
+    * parameter but no name is given.  In that case, just return an empty
+    * string.  Don't worry about tracking the generated name in the printable
+    * names hash because this is the only scope where it can ever appear.
+    */
+   if (var->name == NULL) {
+      static unsigned arg = 1;
+      return ralloc_asprintf(this->mem_ctx, "parameter@%u", arg++);
+   }
+
    /* Do we already have a name for this variable? */
    const char *name = (const char *) hash_table_find(this->printable_names, var);
    if (name != NULL)