Instead, make a new ir_function and try to add it to the symbol table.
Fixes piglit test redeclaration-08.vert.
* seen signature for a function with the same name, or, if a match is found,
* that the previously seen signature does not have an associated definition.
*/
- f = state->symbols->get_function(name);
+ f = state->symbols->get_function(name, false);
if (f != NULL) {
sig = f->exact_matching_signature(&hir_parameters);
if (sig != NULL) {
return entry != NULL ? entry->t : NULL;
}
-ir_function *glsl_symbol_table::get_function(const char *name)
+ir_function *glsl_symbol_table::get_function(const char *name,
+ bool return_constructors)
{
symbol_table_entry *entry = get_entry(name);
- return entry != NULL ? entry->f : NULL;
+ // If there's a type, the function is a constructor; caller may not want it.
+ if (entry != NULL && (return_constructors || entry->t == NULL))
+ return entry->f;
+
+ return NULL;
}
symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
/*@{*/
ir_variable *get_variable(const char *name);
const glsl_type *get_type(const char *name);
- ir_function *get_function(const char *name);
+ ir_function *get_function(const char *name, bool return_constructors = true);
/*@}*/
private: