glsl: Make ir_dereference_array constructor assert the variable exists.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 13 Mar 2012 19:39:32 +0000 (12:39 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 26 Mar 2012 17:21:51 +0000 (10:21 -0700)
commit25b0d45d038774406f2bb7173abc33a3cb261db2
treee5aaec71287d309ad559ec601986d719dd7e87f2
parentced54dcf9b496dbe0bf254673ecee37014c1ee3b
glsl: Make ir_dereference_array constructor assert the variable exists.

Providing a NULL pointer to the ir_dereference_array() constructor seems
like a bad idea.  Currently, if provided NULL, it returns a partially
constructed value of error type.  However, none of the callers are
prepared to handle that scenario.

Code inspection shows that all callers do one of the following:
- Already NULL-check the argument prior to creating the dereference
- Already deference the argument (and thus would crash if it were NULL)
- Newly allocate the argument.

Thus, it should be safe to simply assert the value passed is not NULL.
This should also catch issues right away, rather than dying later.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/glsl/ir.cpp