glsl: make the redeclared variable NULL if it is deleted
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 13 Sep 2017 07:08:01 +0000 (09:08 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Thu, 14 Sep 2017 09:23:26 +0000 (11:23 +0200)
commita7017746d77f33cb60af20c9fcefeb0e6ac89fd4
treebe7f41639ccb9eb914894f3027e0942720d6f017
parent4af156224ea8d5c21464f02aecc25f64de681170
glsl: make the redeclared variable NULL if it is deleted

get_variable_being_redeclared() can delete the original variable
in a specific scenario. The code sets it to NULL after this so other
code in that same function doesn't try to access trashed memory after
the fact, however, the copy of that variable in the caller code
won't see any of this making it very easy to overlook.

Make the function a bit safer by taking a pointer to the original
variable so we can also make NULL the caller's pointer to the variable
if this function deletes it.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/compiler/glsl/ast_to_hir.cpp