glsl: Refactor AST-to-HIR code handling variable initializers
[mesa.git] / src / glsl / ir_variable_refcount.cpp
index 20c2f6602bf229c749a069c932ebfbdd10fd58a9..7d39abb3682e2d96a911c7814afc9f742fccc070 100644 (file)
 #include "ir_variable_refcount.h"
 #include "glsl_types.h"
 
+
+// constructor
+variable_entry::variable_entry(ir_variable *var)
+{
+   this->var = var;
+   assign = NULL;
+   assigned_count = 0;
+   declaration = false;
+   referenced_count = 0;
+}
+
+
 variable_entry *
 ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
 {
@@ -45,6 +57,7 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var)
    }
 
    variable_entry *entry = new(mem_ctx) variable_entry(var);
+   assert(entry->referenced_count == 0);
    this->variable_list.push_tail(entry);
    return entry;
 }